日期:2014-05-16  浏览次数:20644 次

left join 和 left outer join 的区别

left join 和 left outer join 的区别

??A???left???join???B???的连接的记录数与A表的记录数同??
??A???left???join???B???等价B???right???join???A??
???
??1???????????????????????a??
??4???????????????????????c??
??table???B:??
??1???????????????????????x??
??4???????????????????????z??
??select???a.Field_K,???a.Field_A,???b.Field_K,???b.Field_B??
??from???a???left???join???b???on???a.Field_K=b.Field_K??
??Field_K?????????Field_A?????????Field_K?????????Field_B??????????
??----------???----------???----------???----------????
??3?????????????????????b?????????????????????NULL???????????????NULL??
??4?????????????????????c?????????????????????4?????????????????????z????????????????????
??select???a.Field_K,???a.Field_A,???b.Field_K,???b.Field_B??
??from???a???right???join???b???on???a.Field_K=b.Field_K??
??Field_K?????????Field_A?????????Field_K?????????Field_B??????????
??----------???----------???----------???----------????
??NULL???????????????NULL???????????????2?????????????????????y????????????????????
??