Skip to content

Instantly share code, notes, and snippets.

@juareznjunior
Created November 20, 2014 19:51
Show Gist options
  • Save juareznjunior/a2ef3e46f4fe7a562c52 to your computer and use it in GitHub Desktop.
Save juareznjunior/a2ef3e46f4fe7a562c52 to your computer and use it in GitHub Desktop.
facebook.grupo.postgresql
SELECT DISTINCT ON(contrato)
contrato
,sum(hora) OVER(PARTITION BY contrato)
FROM (
SELECT
unnest(ARRAY[1,1,1,1]) contrato
,unnest(ARRAY[2,1,2,4]::numeric[]) hora
) a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment