求助一句简单的SQL,解决立刻揭帖
有3个字段,a   和   b   和   awin   数据类型都是real    
 我现在查询awin=1.4   的数据       
 select   *   from   table   where   hwin   =   1.4   
 这样出现了268条   
 然后我想分别统计这268条里面   a-b> 0有多少条   a-b=0有多少条   a-b <0有多少条   
 select   count(hwin)   as   s   from   table   where   (a-b)> 0   and   hwin   =1.4       
 这样只查询出(a-b)> 0      我想要的效果是一句把a-b> 0   =0    <0   全部查询出来      
 不要用union      那样查出来会是    
 s 
 18 
 80 
 170   
 我要的效果是      
 s               s                  s 
 18         80                  170   
 请问怎么实现?   谢谢!
------解决方案--------------------select  
 sum(case when (a-b)> 0 then 1 else 0 end) as [(a-b)> 0], 
 sum(case when (a-b)=0 then 1 else 0 end) as [(a-b)=0], 
 sum(case when (a-b) <0 then 1 else 0 end) as [(a-b) <0] 
 from table  
 where hwin = 1.4