Created
June 8, 2020 15:27
-
-
Save robindegen/60a3d24ae02899b86b2f3e2abff5b518 to your computer and use it in GitHub Desktop.
SQL row to columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select Parts.Id, Parts.Name, Parts.CreatedTimestamp, | |
MAX(CASE WHEN Key = "TEST" THEN Value END) test_key, | |
MAX(CASE WHEN Key = "ANOTHER" THEN Value END) another_key | |
from parts | |
left outer join Properties P on Parts.Id = P.PartId | |
group by Parts.Id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment