目前我正在做这个查询:
select a.x, b.x, c.x
from number as a, customer as b, numbergroup as c
where a.b = b.b and a.c = c.c and c.b = b.b
但是,我想从表“a”中检索记录,即使“a.c = null”,由于“a”和“c”之间的连接而无法检索到。
我找到了有关 left join
的信息但是当查询涉及两个以上的表时,我不知道该怎么做。
最佳答案
select a.x, b.x, c.x
from number as a
left join customer as b on a.b = b.b
left join numbergroup as c on a.c = c.c and c.b = b.b
关于mysql - 如何对超过 2 个表进行 LEFT JOIN?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7980052/