Solved

When can I use PIVOT and when should I use UNPIVOT?I

Posted on 2014-01-23
1
232 Views
Last Modified: 2014-01-24
Can anyone please tell me when I should be using PIVOT and when I should be using UNPIVOT?
0
Comment
Question by:RajG1978
1 Comment
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39805545
If you receive a normalized table, you can use PIVOT (scroll down for some examples) to change it so that it is pivoted, i.e. rows-columns-value, like an Excel spreadsheet.

If you receive PIVOTED data, and wish to normalize it, that would be an UNPIVOT.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

685 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