这个sql语句应该怎么写啊?
表A
id content
1 aaa
2 bbb
3 ccc表B
aid bbid score
1 4 20
2 3 30
怎么可以选出
id content aid bbid score
1 aaa 1 4 20
2 bbb null null null
3 ccc null null null
也就是 A.id = B.aid bbid = 4 为条件左联?
表A
id content
1 aaa
2 bbb
3 ccc表B
aid bbid score
1 4 20
2 3 30
怎么可以选出
id content aid bbid score
1 aaa 1 4 20
2 bbb null null null
3 ccc null null null
也就是 A.id = B.aid bbid = 4 为条件左联?
ON ( A.id = B.aid and b.bid = 4 )试下
from A a left join B b on a.id = b.aid and b.bbid = 4;