mysql里面的count函数连表查询某个字段在另一张表的数量

select c.*,
(select count(hcus.id) from hcus where c.id=hcus.id and study_status='finished') as learnStuNum,
(select count(hcus.id) from hcus where c.id=id ) as learnNum
from c
where c.id=#{id}
posted @ 2022-05-29 21:17  wyuioahxvm  阅读(722)  评论(0编辑  收藏  举报