Created
January 28, 2013 18:07
-
-
Save caseydentinger/4657707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$q = 'select sum(op.products_quantity) as quantity | |
from orders_products op | |
join ( | |
select distinct orders_id | |
from orders | |
where orders_status in (1,5) | |
) o on o.orders_id = op.orders_id | |
join ( | |
select distinct products_id | |
from parts | |
where parts_id = ' . $dbi->escape($this->id()) . ' | |
) p on p.products_id = op.products_id'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment