如何选择mystatus
场只包含0选择记录中GROUP_CONCAT()包含一个char
select c.id,count(*),
group_concat(distinct(r.status not in ('Done','None'))) as mystatus
from cases c inner join reports r
on (c.id = r.parent_id and r.parent_type = 'Cases' and r.deleted = 0)
where c.deleted = 0
and c. status <> 'Late'
group by c.id
结果看起来是这样,但我想选择只mystatus
包含0
ID count(*) mystatus
A 1 0
B 7 0,1
C 2 0
它应该是选择记录ID A和C
这对我很有用:D非常感谢。 – May