Skip to content

Instantly share code, notes, and snippets.

@tawman
Created January 17, 2018 03:02
Show Gist options
  • Save tawman/4fb482eeefe3d91c2616c3e1ae5abbdf to your computer and use it in GitHub Desktop.
Save tawman/4fb482eeefe3d91c2616c3e1ae5abbdf to your computer and use it in GitHub Desktop.
A Simple SQL PIVOT Query
SELECT *
FROM(SELECT * FROM UserRequirement) AS UserInfo
PIVOT (MIN(ExpirationDate)
FOR Requirement IN ([Alpha], [Bravo], [Charlie], [Delta], [Echo])
) AS UserPivot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment