select t0.staff_id, t0.staff_name, t0.tel, IFNULL(t1.amount, 0) as amount
from lq_org_staff t0
left join
(SELECT count(*) as amount, t1.follow_id
from lq_student t1
GROUP BY t1.follow_id)
as t1 on t1.follow_id = t0.staff_id
group_by 类型分组查询为空时补0
最新推荐文章于 2021-10-12 14:00:52 发布