RE: FN-FORUM: Help/guidance with a bit of tricky php/MySQL
date posted 4th March 2008 12:04
Hi Duncan,=20
I would probably do the query something like this:
select productid, variant, sum(quantity) from Order=5Fitems
group by productid, variant
order by sum(quantity) desc;
then you could add a limit or something in there if you needed to also,
Joe Rawlinson
Original Message:
-----------------
How to do it:
The lame way of doing it would be to go through the products and (if
applicable) their variants, and for each, querying Order=5Fitems,
returning all the entries, and totalling up their quantity fields, and
storing this into somekind of array=2E I am not very good with joins,
which I am guessing may also be needed=2E I can think of doing this
otherwise by storing the results in a table, but with over 4,000
orders and 18,000 order items, I need to be thinking about a very
efficient algorithm=2E
Over to you, anyone with any ideas to point me in the right direction=3F
Many thanks,
Duncan
--=20
--------------------------------------------------------------------
mail2web=2Ecom - Microsoft=AE Exchange solutions from a leading provider -=
http://link=2Email2web=2Ecom/Business/Exchange