Zen Follower
- Join Date:
- Dec 2008
- Location:
- Pittsburgh, PA
- Posts:
- 241
- Plugin Contributions:
- 0
Vendor Invoice History Table Add-on Dev (COGS by invoice)
so can anyone help me out w/ an sql statement?
I've added products_cost and products_invoice to the products table. I want to figure out the cost of the sold products grouped by invoice name. (products_invoice would be something like "023014Distributor003" and have 30 or so products on it; not very atomized I know)
This statement seems to run forever in phpMyAdmin
SELECT p.products_id, p.products_invoice, sum(p.products_cost)
FROM products p, orders_products op
WHERE op.products_quantity>0
GROUP BY p.products_invoice
seriously stuck on this one... thanks.