MySQLinnerjoin和leftjoin的区别看了⽹上⼀些讲的感觉还是云⾥雾⾥,不如⾃⼰实操⼀下。
sql语句,left join
pe_id,
isad.activity_id,
isad.id,
  f.status
from
inspection_store_activity_detail isad
inner join inspection_store_type ist pe_id = ist.id
left join inspection_store_follow f on isad.id = f.activity_detail_id
inner join
pe_id,
isad.activity_id,
isad.id,
f.status
from
inspection_store_activity_detail isad
inner join inspection_store_type ist pe_id = ist.id
inner join inspection_store_follow f on isad.id = f.activity_detail_id
如图,inner join在连接的表在要查询的字段有空时,该条记录不会被查询出来,主表信息也不保留。left join 是主表信息都保留,连接的表有该字段展⽰,没有就展⽰null。sql left join 多表连接

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。