------------------------------------
Item | Box
------------------------------------
10 | 25
------------------------------------
12 | 50
------------------------------------
3 | 25
------------------------------------
4 | 30
------------------------------------
6 | 50
------------------------------------
Output Should be
[25] => 13 , [50] => 18, [30] => 4
I am using following query but i am getting the result
select sum(item) as qt from table group by box
Please help me to solve my problem
答案 0 :(得分:2)
try this :
SELECT sum(item) as qt, box
FROM tablename
GROUP BY box
ORDER BY qt