胜负

来源:互联网 发布:中智软件开发有限公司 编辑:程序博客网 时间:2024/04/23 15:31
create table tmp(rq varchar(10),shengfu nchar(1))select * from tmpinsert into tmp values('2005-05-09','胜')insert into tmp values('2005-05-09','胜')insert into tmp values('2005-05-09','负')insert into tmp values('2005-05-09','负')insert into tmp values('2005-05-10','胜')insert into tmp values('2005-05-10','负')insert into tmp values('2005-05-10','负')select rq,sum(case when shengfu='胜'then 1else 0end)as 胜,sum(case when shengfu='负'then 1else 0end)as 负from tmpgroup by rq

0 0
原创粉丝点击