Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
damegu
Starting Member
5 Posts |
Posted - 2014-08-27 : 05:25:49
|
Hello,I would like to know if it is possible to do a SELECT statement where I can denormalize my table. I am not sure if it is needed to create a new table at first and insert denormalized values into the created table.exampleoriginal table:ID XXX VALUES1 a 101 b 151 c 8And I want to use SELECT to get this table:ID a b c 1 10 15 8 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-08-27 : 06:12:13
|
[code]SELECT *FROM ( SELECT ID, XXX, VALUES FROM original_table ) d PIVOT ( MAX(VALUES) FOR XXX IN ([a], [b], [c]) ) p[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|