Transpose Column to row

create table #temp
(timeId int, dim1Id int, dim2Id int, Value decimal(25,10))

insert into #temp
values
(1, 1, 1, 111)
,(1, 1, 2, 112)
,(1, 2, 1, 121)
,(1, 2, 2, 122)
,(2, 1, 1, 211)
,(2, 1, 2, 212)
,(2, 2, 1, 221)
,(2, 2, 2, 222)


select dim1Id, dim2Id, [1], [2]
from
(select * from #temp) as sourceTable
pivot
(sum(Value) for TimeId in ([1], [2])) as pivotTable



drop table #temp

I want to drink a coffee :-)


Sponsored Links


Ricerca


Ultimi Contenuti Inseriti

C# ASP.NET
...

How to add onload property to masterpage from child
HtmlGenericControl body = (HtmlGeneric...

SQL Server
...

Transpose Column to row
create table #temp (timeId int, dim1Id int, dim2I...

(X) HTML
Suggerimenti ed esempi riguardanti il linguaggio H...

Sponsor