mysql 表表连接的问题。

 

select * from table a, table b where a.aid = b.bid and aid >100

这样连接,如果a有数据,b没有数据,  a.aid = b.bid对不上号的时候,就是null,数据不会搜索出来。

select * from table a left join table b on a.aid = b.bid where  and aid > 100;

这样连接,如果a有数据,b没有数据, a.aid = b.bid对不上号的时候,会搜索出来数,只是b字段都是null而已。

 

posted @ 2015-03-20 14:13  shenbin23  阅读(147)  评论(0编辑  收藏  举报