gotolovo
CREATE TABLE [dbo].[Table_2](
	[rq] [datetime] NOT NULL,
	[shengfu] [nvarchar](4) NOT NULL
) ON [PRIMARY]


--insert into Table_2(rq,shengfu) values(\'2010-9-1\',\'胜\')
--insert into Table_2(rq,shengfu) values(\'2010-9-1\',\'胜\')
--insert into Table_2(rq,shengfu) values(\'2010-9-1\',\'负\')
--insert into Table_2(rq,shengfu) values(\'2010-9-1\',\'负\')
--insert into Table_2(rq,shengfu) values(\'2010-9-2\',\'负\')
--insert into Table_2(rq,shengfu) values(\'2010-9-2\',\'负\')
--insert into Table_2(rq,shengfu) values(\'2010-9-2\',\'负\')
--insert into Table_2(rq,shengfu) values(\'2010-9-2\',\'胜\')

生成格式如下:

 

rq
2010-09-01 2 3
2010-09-02 1 3

 

select rq, sum(CASe when shengfu =\'胜\' then 1 else 0 end) as 胜,
sum( CASe when shengfu =\'负\' then 1 else 0 end) as 负
from Table_2
group by rq

分类:

技术点:

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-11-09
  • 2022-12-23
  • 2021-11-04
相关资源
相似解决方案