Skip to content

Instantly share code, notes, and snippets.

@eagleon
Created June 4, 2013 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eagleon/5704012 to your computer and use it in GitHub Desktop.
Save eagleon/5704012 to your computer and use it in GitHub Desktop.
select branch_name,
sum(case level when 1 then final_score else 0 end) z_s,
count(case level when 1 then final_score else null end) z_c,
sum(case level when 2 then final_score else 0 end) f_s,
count(case level when 2 then final_score else null end) f_c,
sum( final_score) t_s,
count(final_score) t_c
from temp
group by branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment