Last active
April 3, 2017 13:14
-
-
Save muminoff/2f15c35bafb76fd9913de9f627730189 to your computer and use it in GitHub Desktop.
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
explain analyze | |
select | |
count(age) as samples, | |
case | |
when age < 20 then 2000 | |
when (age >= 20) and (age < 30) then 2030 | |
when (age >= 30) and (age < 40) then 3040 | |
when (age >= 40) and (age < 50) then 4050 | |
when (age >= 50) and (age < 60) then 5060 | |
when age >= 60 then 6000 | |
else '' | |
end as age_category | |
from samples | |
group by age_category; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment