T-SQL Guru - SQL Server PIVOT
It's time for another May TechNet Guru winner!
Naomi N is our T-SQL TechNet Guru for May! See more about the Technology Guru TechNet Wiki for May contest.
About Naomi: I am an IT professional with more than 15 years of experience in variety of programming languages and technologies. I am a Microsoft Community Award Recipient and Personality of the Year at UniversalThread.com forum in 2008,2009,2010,2011.
Here is Naomi's second winning article:
Here are all the May T-SQL winners:
Transact-SQL Technical Guru - May 2013 |
|
Naomi N | Dynamic Pivot on Multiple Columns |
|
|
Naomi N | SQL Server PIVOT |
|
|
Andrew Bainbridge | SQL Server resource re-balancing in Failover Cluster |
|
|
Naomi N | T-SQL: Date-Related Queries |
|
A big thanks to Naomi. This was exactly what we'd hoped for, and Naomi swept the board. Naomi takes two gold medals, as both articles scored exactly the same, when all votes were added up! Also thanks to Andrew for another excellently crafted article, that ticked so many boxes.
And here's an excerpt from the article:
The pivot solution by itself is not complex, it's a simple static PIVOT. But the thread originator was having a problem arriving to it. The main problem is to understand, that all columns which are not mentioned in the PIVOT aggregate function in the PIVOT clause will be aggregated, so if there is a column with unique values in the source table for the pivot and it is not mentioned in the PIVOT clause, it will be a source of the aggregation and therefore the result will have as many rows as you have unique columns in the table defeating the main purpose of the PIVOT.
.
Read the rest here:
Thanks to Naomi for all your great contributions to the TechNet Guru contest! You can read about all the May winners here: TechNet Guru Awards - May 2013
Also, for the June Guru competition, see TechNet Guru June Roundup & Commentary.
Are you a Wiki Ninja? https://technet.com/wiki
- User Ed
Comments
- Anonymous
January 31, 2016
Computers Today (part 1 of 6) blogs.msdn.com/.../computers-today.aspx ..... CS SPOTLIGHT: Girls in computer programming... why it matters!!! blogs.msdn.com/.../cs-spotlight-girls-in-computer-programming-why-it-matters.aspx ... Computational Thinking - Videos & Papers by Jeannette Wing blogs.msdn.com/.../computational-thinking-videos-amp-papers-by-jeannette-wing.aspx