Skip to content

Instantly share code, notes, and snippets.

@samuelbalogh
Last active June 19, 2018 11:02
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 samuelbalogh/8a4fdd55be64a11b8d229af7303868ef to your computer and use it in GitHub Desktop.
Save samuelbalogh/8a4fdd55be64a11b8d229af7303868ef to your computer and use it in GitHub Desktop.
WITH
invoices_for_cancelled_projects AS
(SELECT * FROM invoices, projects
WHERE projects.status = 'cancelled'
AND invoices.project_id = projects.id),
approved_invoices_in_usd AS
(SELECT * FROM invoices
WHERE currency ='USD'
AND status = 'approved')
UPDATE ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment