2016-04-13 36 views
0

表1 表2加入空值

select col1, col2, etc 
from table 1 
left join table 2 
on table1.col1 = table2.col1 

如果table2.col1具有空值,將在某種程度上搞砸了我加入的結果嗎?

回答

1

不,table2空值在這種情況下無關緊要。左連接將匹配從table1table2的所有行。如果table2中的一行在table1中不匹配,它將不會出現在結果集中。