I have an array like this :
$temp
[0]['a']['x'][10],
[1]['a']['x'][-5],
[2]['a']['y'][8]
[3]['b']['x'][5],
[4]['b']['x'][10], .......
1st element represents row number,
2nd element represents item code,
3rd element represents warehouse,
4th element represents quantity
Does anyone know how to create another array based on this array, so that the result is:
[0]['a']['x'][5],
[1]['a']['y'][8],
[2]['b']['x'][15],.....
In sql terms, it means :
SELECT SUM(quantity), item_code, warehouse FROM ItemLedger GROUP BY item_code, warehouse