SELECT m.aid,m.b1id,n.bcon,m.b2id as b2id,o.bcon as b2con, m.b3id as b3id,p.bcon as b3con FROM `test` as m INNER JOIN test1 as n on m.b1id=n.bid INNER JOIN test1 as o on m.b2id=o.bid INNER JOIN test1 as p on m.b3id=p.bid;
结果:
select n.aid, m.bid ,m.bcon , l.bid,l.bcon,o.bid ,o.bcon from
a n join b m on n.b1id=m.bid
join b l on n.b2id=l.bid
join b o on n.b3id=o.bid