Skip to content

Instantly share code, notes, and snippets.

@gerred
Created October 7, 2014 19:27
Show Gist options
  • Save gerred/23947dc13841e049c5b3 to your computer and use it in GitHub Desktop.
Save gerred/23947dc13841e049c5b3 to your computer and use it in GitHub Desktop.
select contract, sum(amount) as total from transactions where org_id = 1 and (expires is null or expires > now()) group by contract having sum(amount) > 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment