现在希望 查询list表 并且需要知道 list 关联的task数目 以及task中 over=1 和over =0 的数目
谢谢
------解决方案--------------------
SQL code
select a.id,a.name,count(b.id) as cnt,
sum(case when b.over = 1 then 1 else 0 end) ocnt1,
sum(case when b.over = 0 then 1 else 0 end) ocnt0
from t_list a left join t_task b on t.id = b.l_id
group by a.id,a.name
------解决方案--------------------