日期:2014-05-19  浏览次数:20539 次

如何用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