mysql 表表连接的问题。

时间:2023-03-08 23:39:36
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而已。