本文介绍了如何用2个以上的桌子进行LEFT JOIN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前我正在执行以下查询:
Currently I am doing this query:
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"之间的连接而无法检索.
However, I want to retrieve records from table "a" even if "a.c = null", which is not retrieved due to the join between "a" and "c".
我找到了有关 left join
的信息,但我不知道如何当查询涉及两个以上的表时(例如在这种情况下),可以执行此操作.
I have found information about left join
but I don't know how to do it when the query involves more than two tables like in this case.
推荐答案
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
这篇关于如何用2个以上的桌子进行LEFT JOIN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!