Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 22, 2020 03:01
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 parzibyte/8ad0295f64e35bb65061f0c0e56d6ece to your computer and use it in GitHub Desktop.
Save parzibyte/8ad0295f64e35bb65061f0c0e56d6ece to your computer and use it in GitHub Desktop.
select alguna_columna, otra_columna,
sum(case when columna_importante = 'valor' then 1 else 0 end) as conteo_valor,
sum(case when columna_importante = 'otro_valor' then 1 else 0 end) as conteo_otro_valor
from tabla
group by alguna_columna;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment