Skip to content

Instantly share code, notes, and snippets.

@nhomar
Created October 10, 2014 15:15
Show Gist options
  • Save nhomar/60c3a226ddb5e274b584 to your computer and use it in GitHub Desktop.
Save nhomar/60c3a226ddb5e274b584 to your computer and use it in GitHub Desktop.
difference
SELECT
l.account_id,
sum(l.debit-l.credit)
FROM account_move_line AS l
INNER JOIN account_account AS a ON a.id = l.account_id
WHERE l.debit-l.credit != 0 AND a.code ilike '1-1-08%' //<<ug l
GROUP BY account_id
/*
Tiempo de ejecución de la sentencia: 11.56 segundos
*/
SELECT
l.account_id,
sum(l.debit-l.credit)
FROM account_move_line AS l
INNER JOIN account_account AS a ON a.id = l.account_id
WHERE l.debit-l.credit != 0 AND a.parent_id = 462 // <<technically perfect and functionally perfect
GROUP BY account_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment