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}
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}