SQL 如何使用sql Query加入2个以上的表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3658774/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 07:27:37  来源:igfitidea点击:

how to join more than 2 table using sql Query?

sql

提问by Fosco

suppose i have more than 2 table and i want to join the specific column to be join .for this what is query?

假设我有 2 个以上的表,我想加入要加入的特定列。为此,什么是查询?

回答by Fosco

example:

例子:

select a.column1, a.column2, b.whatever, c.hello
from table1 a
join table2 b on a.keyfield = b.keyfield
join table3 c on a.keyfield = c.keyfield

If you wanted all records from table1 even without a matching record in another table, then the join should be "left join" instead.

如果您想要 table1 中的所有记录,即使另一个表中没有匹配的记录,那么连接应该是“左连接”。