--第一种
select C.AID,A.NAME,C.BID,B.NAME from C
join A on A.ID=C.AID and A.name like '%%'
join B on B.ID=C.BID and B.name like '%%'
--第二种
select C.AID,A.NAME,C.BID,B.NAME from C
join A on A.ID=C.AID
join B on B.ID=C.BID
where A.name like '%%'
and B.name like '%%'