You can use
group by and
select color, count(*) cnt from mytable group by color having min(status) = max(status) and min(status) = 'approved'
having clause ensures that there is only one distinct value in the group, whose value is
In MySQ, you could also phrase the
having clause like so:
having max(status <> 'approved') = 0
having not max(status <> 'approved')
CLICK HERE to find out more related problems solutions.