Created
November 8, 2016 21:30
-
-
Save gjask/a1e6486f505caacc1eabf45cba7f6a19 to your computer and use it in GitHub Desktop.
pure SQL PIVOT alternative
This file contains 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 | |
number_id, | |
sum(case when gate = 1 then points end) gate1, | |
sum(case when gate = 2 then points end) gate2, | |
sum(points) points_total | |
from check | |
group by number_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment