Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3005
  • Last Modified:

SQL Server Examples of Pivot Tables

Hi
Does anyone know of a site that shows a few examples of SQL Pivot table queries.
I tried W3Schools but couldn't find anything there
0
Murray Brown
Asked:
Murray Brown
2 Solutions
 
Kevin CrossChief Technology OfficerCommented:
You can try Mark and my articles here at EE:

-Dynamic Pivot Procedure for SQL Server
-Pivot Rolling Periods Without Using Dynamic T-SQL
-Broaden Your Horizons : Pivot Again!

The Technet article above is pretty good, though.  You should be able to construct most queries you need from there.  The key to remember is you need a finite, pre-defined list for PIVOT.  If not, you will have to use dynamic SQL.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now