Re: FN-FORUM: Help/guidance with a bit of tricky php/MySQL
date posted 4th March 2008 12:43
Morning Joe,
Thanks for that, worked a treat, except I had to change it to
select productid, variant, sum(quantity) AS quantity_alias from Order_items
group by productid, variant
order by quantity_alias desc;
I was wondering if you or someone else could help. There is an extra
layer of complication I need to add to this, then I am done:
Each Order_Items entry is assigned to a specific Order by orderid.
What I need to do is only be counting the quantities in Order_Items of
products and variants which form part of an order where the
orderstatus in the Order table is set to "Completed".
So:
SELECT productid, variant, sum(quantity) AS quantity_alias from Order_items
WHERE orderstatus IN Orders = Paid
group by productid, variant
order by quantity_alias desc;
Any ideas?
Thanks for your help by the way, and sorry for bugging you!!!
Cheers,
Duncan