LEFTJOIN右表为空也查出数据
sql 写错了 你懂的:百度查询
select
t1.user_id ,  t1.count count
,t2.followersCount followersCount
,certification_type,audit_status,audit_time
from
(select count(1) followersCount from my_user_attention where followed_id =717331839533973504and type="1"and status="0")as t2
,(select count(1) count ,717331839533973504as user_id  from my_user_attention where user_id =717331839533973504and type="1"and st atus="0")as t1
left join my_certification t3 on t3.user_id=717331839533973504and  audit_status ="3"
select
t1.user_id ,  t1.count count
,t2.followersCount followersCount
sql left join 多表连接
,certification_type,audit_status,audit_time
from
(select count(1) followersCount from my_user_attention where followed_id =717331839533973504and type="1"and status="0")as t2
,(select count(1) count ,717331839533973504as user_id  from my_user_attention where user_id =717331839533973504and type="1"and st atus="0")as t1
left join my_certification t3 on t3.user_id=717331839533973504where audit_status ="3"
我的sql : 看最后就ok了 好久啊 and 和 where ⽤法
where audit_status =“3” 和 and audit_status =“3” where 作⽤于 整个sql 条件

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