下载此文档

sqlserverpivot用法SQLServer的支点用法.doc


文档分类:IT计算机 | 页数:约6页 举报非法文档有奖
1/6
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/6 下载此文档
文档列表 文档介绍
sql server pivot 用法(SQL Server 的支点用法)
Explain the usage of PIVOT/UNPIVOT through two examples
Release time: 2008. 03. sql server pivot 用法(SQL Server 的支点用法)
Explain the usage of PIVOT/UNPIVOT through two examples
Release time: 2008. 03. 13 04:58 source: CCID, author: ChenJaYi
[reports] CCIDNET IT technology used SQL Server 2000 of the people know, in order to achieve the ranks of the conversion, must use aggregate functions and dynamic SQL, specific implementation requires certain skills, while in SQL Server 2005, using the new keyword PIVOT/UNPIVOT, you can easily achieve the ranks of the conversion requirements.
In this article, we' 11 explain the usage of PIVOT/UNPIVOT in two simple examples.
The use of PIVOT:
First, create the test table and then insert the test data
Create, table, test (ID, int, profile, int)
name, varchar (20), quarter, int,
Insert, into, test, values
(l,'a‘,11000)
Insert, into, test, values
(l,'a‘,22000)
Insert, into, test, values
(l,'a‘,34000)
Insert, into, test, values
(l,'a‘,45000)
Insert, into, test, values (2,' b' , 13000)
Insert, into, test, values (2,' b' , 23500)
Insert, into, test, values (2,' b' , 34200)
Insert, into, test, values (2,' b' , 45500)
Select * from test
ID name quarter profile
1 a 11000
1 a 22000
1 a 34000
a 45000
B 13000
2 B 23500
2 B 34200
2 B 45500 (8, row (s) affected)
Use PIVOT to convert four

sqlserverpivot用法SQLServer的支点用法 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数6
  • 收藏数0 收藏
  • 顶次数0
  • 上传人小健
  • 文件大小83 KB
  • 时间2022-05-20