Solved

SQL Server Examples of Pivot Tables

Posted on 2014-01-23
2
2,559 Views
Last Modified: 2014-01-26
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
Comment
Question by:murbro
2 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 250 total points
ID: 39803943
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 250 total points
ID: 39804096
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question