如何比较左连接中的多个值?
我有两张桌子
table a id val 1 a 2 b 3 c 4 a table b val fullform a apple b banana c cat
我会写,
select a.id, b.fullform from a left join b on a.val=b.val
我假设它将加入a = a或b = b
我想这样比较,
select a.id, b.fullform from a left join b on a.val in (a,b)
是否可以不在WHERE
中写出来。
答案 0 :(得分:0)
你很亲密:
select a.id, b.fullform from a left join b on a.val = b.val
where a.val in (a,b)