惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
S
SegmentFault 最新的问题
Project Zero
Project Zero
D
DataBreaches.Net
I
InfoQ
L
Lohrmann on Cybersecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
The Register - Security
The Register - Security
Recorded Future
Recorded Future
Vercel News
Vercel News
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
Intezer
The Hacker News
The Hacker News
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Scott Helme
Scott Helme
T
Threatpost
爱范儿
爱范儿
N
Netflix TechBlog - Medium
D
Docker
云风的 BLOG
云风的 BLOG
C
Cisco Blogs
K
Kaspersky official blog
H
Help Net Security
S
Secure Thoughts
T
Threat Research - Cisco Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
N
News and Events Feed by Topic
G
Google Developers Blog
Forbes - Security
Forbes - Security
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
B
Blog
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
Simon Willison's Weblog
Simon Willison's Weblog
S
Securelist
P
Privacy International News Feed
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog

博客园 - gotolovo

导出csv 导出excel 正则学习电话匹配 logmanager des 加密 解密 - gotolovo c# 发送邮件 工作流学习过程-事务 工作流学习过程-状态机 蛋疼的viewstate 工作流学习过程-持久化服务 工作流学习过程-使用关联 工作流学习过程-本地服务之事件处理 工作流学习过程-本地服务之调用方法 工作流学习过程-验证活动 工作流学习过程-自定义活动 工作流学习过程-开篇 基本的几个排序算法 关于sql中时间的格式转换 请编程遍历页面上所有TextBox控件并给它赋值为空
数据行变列
gotolovo · 2010-06-25 · via 博客园 - 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