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

推荐订阅源

S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
P
Palo Alto Networks Blog
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
S
Schneier on Security
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
雷峰网
雷峰网
T
Tenable Blog
人人都是产品经理
人人都是产品经理
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
AWS News Blog
AWS News Blog
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Scott Helme
Scott Helme
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Recorded Future
Recorded Future
I
InfoQ
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
Cloudbric
Cloudbric
C
Check Point Blog
Engineering at Meta
Engineering at Meta
TaoSecurity Blog
TaoSecurity Blog
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
腾讯CDC
量子位
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
Kaspersky official blog
Vercel News
Vercel News
F
Full Disclosure
T
Troy Hunt's Blog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs

博客园 - 白天的萤火虫

Net开源框架/项目,你研究过几个? 主题:实用且不花哨的js代码大全 关于模拟注册登录的 字字带泪-写在三十岁到来这一天 关于silverlight的安装 推荐一个IE下的优秀js调试工具(Companion.JS) 给分页控件增加一列 编号 关于Ajax的web配置 - 白天的萤火虫 - 博客园 获取HTML代码 - 白天的萤火虫 - 博客园 最新Silverlight开发环境配置介绍 sql server中的存储过程调试 PetShop介绍集锦 DIV+CSS实现圆角 button 绑定 enter键 转载---使用Ajax实现DropDownList和ListBox的联动以及两个ListBox之间数据的移动 自己调试通过的存储过程 又一个通用分页存储过程,支持表别名,多表联合查询SQL语句--转载 写入和读取cookie CascadingDropDown从数据库中读取数据绑定到DropDownList控件上
一个行转列的例子
白天的萤火虫 · 2008-12-17 · via 博客园 - 白天的萤火虫


CREATE TABLE [TABLE1] (
 [id] [int] IDENTITY (1, 1) NOT NULL ,
 [name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [state] [int] NULL ,
 CONSTRAINT [PK_TABLE1] PRIMARY KEY  CLUSTERED
 (
  [id]
 )  ON [PRIMARY]
) ON [PRIMARY]
GO

DECLARE @s nvarchar(4000)
SET @s='SELECT name'
SELECT @s=@s+','+QUOTENAME(state )+N'=
SUM(CASE state WHEN '+QUOTENAME(state ,N'''')+N'
then 1 else 0 end)'FROM table1 GROUP BY state
EXEC(@s+N'FROM table1 GROUP  BY name')