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

Can anyone please tell me when I should be using PIVOT and when I should be using UNPIVOT?
RajG1978Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.