select * from A where id not in (select id from B) select class from c where sex='男' group by class having count(id)>=0 select class from c group by having count(case when sex='男' then 1 else 0 end)>10 and count(case when sex='女' then 1 else 0 end)>5
select * from A where id not in (select id from B) select class from c where sex='男' group by class having count(id)>=10 select class from c group by class having count(case when sex='男' then 1 else 0 end)>=10 and count(case when sex='女' then 1 else 0 end)>=5
请问 case when sex='男' then 1 else 0 end 放在count 是什么意思 不太理解 谢谢
select class from c where sex='男' group by class having count(id)>=0
select class from c group by having count(case when sex='男' then 1 else 0 end)>10
and count(case when sex='女' then 1 else 0 end)>5
select class from c where sex='男' group by class having count(id)>=10
select class from c group by class having count(case when sex='男' then 1 else 0 end)>=10
and count(case when sex='女' then 1 else 0 end)>=5