求sql语句...
时间 结果
2012-05-01 胜
2012-05-01 胜
2012-05-01 败
2012-05-01 败
2012-05-02 胜
2012-05-02 胜
2012-05-02 败
显示查询结果
胜 负
2012-05-01 2 2
2012-05-02 2 1
求sql语句的写法...急........
------解决方案--------------------select 时间,sum(case when 结果='胜' then 1 else 0 end) as 胜,sum(case when 结果='败' then 1 else 0 end) as 败
from tb
group by 时间