February 22, 201214 yr I have a table in my database similar to the one shown below pcode | cases | packets | order_id| ---------------------------------- F0570 | 2 | 1 | 45671 | ----------------------------------- F0570 | 1 | 3 | 45672 | ----------------------------------- F0570 | 4 | 2 | 45673 | ----------------------------------- What i am trying to do is use php/mysql to tell me how many cases and packets there are for each product code. I can obviously see that there are 7 cases and 6 packets ordered for this particular product. But what i am trying to do is transfer this into another table which will produce a picking list (below) but i can't work out how to get the totals for each product. I have tried COUNT and SUM but get really odd results that don't help pcode | cases | packets | ------------------------- FO570 | 7 | 6 | -------------------------
Create an account or sign in to comment