34,588
社区成员
发帖
与我相关
我的任务
分享
select a.*,b.hosc_price from mac_item a left outer JOIN handleofficial_storagechild b on a.macbs_sid=b.hosc_macbs_sid
用这个sql语句查询两个表的数据,结果a.*数据出来了,b.hosc_price的数据全部显示NULL。我换成select a.*,b.hosc_price from mac_item a right outer JOIN handleofficial_storagechild b on a.macbs_sid=b.hosc_macbs_sid
查询的时候,a.*的全是NULL,b.hosc_price倒是出来了。select a.*,b.hosc_price
from mac_item a
left outer JOIN handleofficial_storagechild b ---左连接就是以左表为主,左表全部查出来,再找出符合条件的右表数据,如果没有则显示null,右连接反之。
on a.macbs_sid=b.hosc_macbs_sid