目前我正在进行此查询:
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”之间的连接而未检索到该记录。
我找到了关于“左连接”的信息(http://www.w3schools.com/sql/sql_join_left.asp),但是当查询涉及两个以上的表时,我不知道怎么做这种情况。
非常感谢任何帮助或指导。
答案 0 :(得分:36)
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