如何用1个select 语句选出group by 后符合要求的结果
select count(*) as Count,Type from table1 group by type 后得到结果
count , Type
1 A
10 B
2 C
现在我想要只列出 type=A 或 type=C 的,这个select 语句怎么写?
[解决办法]
select count(*) as Count,Type from table1 group by type having type= 'A ' or type= 'C '
[解决办法]
select count(*) as Count,Type
from table1
where type = 'A ' or type = 'C '
group by type
[解决办法]
select count(*) as Count,Type from table1 Where Type = 'A ' Or type = 'C ' group by type