select id from b join a on b.id=a.a or b.id=a.b or b.id=a.c or b.id=a.d
select * from
(select A.a,B.content as contentFora from A LEFT JOIN B on A.a=B.id) as table1
(select A.b,B.content as contentForb from A LEFT JOIN B on A.b=B.id) as table2
(select A.c,B.content as contentForc from A LEFT JOIN B on A.c=B.id) as table3
(select A.d,B.content as contentFord from A LEFT JOIN B on A.d=B.id) as table4
SELECT m.*,n.path as coverPath,o.path AS cover1Path ,p.path AS cover2Path, a.path AS cover3Path ,p.path AS erweimaPath
FROM photo as m
INNER JOIN attachment as n on m.cover=n.id
INNER JOIN attachment as o on m.cover1=o.id
INNER JOIN attachment as p on m.cover2=p.id
INNER JOIN attachment as a on m.cover3=a.id
INNER JOIN attachment as b on m.erweima=b.id;
什么鬼?打比方能不能专业点?