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

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - IT-民工

Sqlsever Kill locked process Linked Server Dependencies C# PDF添加水印 Excel Vlookup多条件查询 , 列转行 C# 编写ActiveX Microsoft.Office.Interop.Excel error: 80070005 C# Linq 分页查询模板 SQLServer 查询 Excel ISO 纸张尺寸定义 检测SQLSERVER 连接 刷新SQLserver 视图 Sql Server 邮件日志 操作 常用连接 导出Excel Asp.net 多国语言-注意点 SqlServer 备份数据库语法 SqlServer To SqlServer 建立 链接服务器 Linked Server sqlserver 根据内容,查询表和列名字 Sqlserver 2005 修改数据库默认排序
SqlServer 行列互转
IT-民工 · 2012-04-07 · via 博客园 - IT-民工

  需求 : 行列转换

实现SQL :  

SELECT  *

FROM    ( SELECT Item , Grp = 'Overoll' , Num = [Overoll] FROM #test
          UNION ALL
          SELECT Item ,    Grp = 'I_Branch' ,    Num = [I_Branch]    FROM    #test
          UNION ALL
          SELECT Item ,    Grp = 'P_Branch' ,    Num = [P_Branch]    FROM    #test
          UNION ALL
          SELECT Item ,    Grp = 'CNG' ,    Num = [CNG]    FROM    #test
          UNION ALL
          SELECT Item ,    Grp = 'Transmitter' ,    Num = [Transmitter]    FROM    #test
        ) t PIVOT MAX(Num) FOR Item IN ( [Booking][Shpment][OD_CRD],  [OD_PD] ) ) pivt