My database record is as below:-
cartid orderid foodid qty
==============================
92 107 5 1
93 107 5 1
94 107 5 1
95 107 11 1
96 107 5 1
97 108 5 1
Can it be arrange into this form?
Assume that the max sum(qty)=3
foodid sum(qty)
=================
5 3
11 1
5 2