如何選擇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