Skip to content

Instantly share code, notes, and snippets.

@caseydentinger
Created January 28, 2013 16:44
Show Gist options
  • Save caseydentinger/4657086 to your computer and use it in GitHub Desktop.
Save caseydentinger/4657086 to your computer and use it in GitHub Desktop.
select sum(op.products_quantity) as quantity
from orders o
join orders_products op on o.orders_id = op.orders_id
join products p on op.products_id = p.products_id
join parts pa on p.products_id = pa.products_id
where o.orders_status in (1,5)
and pa.parts_id = xxxx;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment