更新时间:2022-04-15 07:05:36
访问这里....
http://blog.sqlauthority.com/2012/10/31/ sql-server-copy-data-from-one-table-to-another-table-sql-in-sixty-seconds-031-video / [ ^ ]
或
http://www.sqlservercentral.com/Forums/Topic503363-8-1.aspx [ ^ ]
visit here....
http://blog.sqlauthority.com/2012/10/31/sql-server-copy-data-from-one-table-to-another-table-sql-in-sixty-seconds-031-video/[^]
or
http://www.sqlservercentral.com/Forums/Topic503363-8-1.aspx[^]
-- TempTable
Select DATE,Car,Bike,Cycle Into #TableName
From
(Select DATE,SettingName,SettingValue From T01)u
PIVOT(Sum(SettingValue) For SettingName in(Car,Bike,Cycle)) AS Pvt
-- New Table
Create Table TableName (Columns)
Insert TableName
Select DATE,Car,Bike,Cycle
From
(Select DATE,SettingName,SettingValue From T01)u
PIVOT(Sum(SettingValue) For SettingName in(Car,Bike,Cycle)) AS Pvt