I have this select Case SQL statement which compute the totalvolume of a given quantity.
SELECT
DropshipPackinglist.CaseNumber as 'CASE NO.',
DropshipPackinglist.ItemNumber as 'BOM NO.',
DropshipPackinglist.Quantity as 'QTY',
CASE
WHEN DropshipPackinglist.Quantity >=31 and DropshipPackinglist.Quantity <= 36 then '1090x730x1460'
WHEN DropshipPackinglist.Quantity >=25 and DropshipPackinglist.Quantity <= 30 then '1090x730x1230'
WHEN DropshipPackinglist.Quantity >=19 and DropshipPackinglist.Quantity <= 24 then '1090x730x1000'
WHEN DropshipPackinglist.Quantity >=13 and DropshipPackinglist.Quantity <= 18 then '1090x720x790'
WHEN DropshipPackinglist.Quantity >=7 and DropshipPackinglist.Quantity <= 17 then '1090x720x570'
WHEN DropshipPackinglist.Quantity >=1 and DropshipPackinglist.Quantity <= 6 then '1090x720x350'
ELSE 'Unkown'
end
as 'TOTAL VOLUME (MM3)'
FROM DropshipPackinglist INNER JOIN
HuaweiDescription ON DropshipPackinglist.ItemNumber = HuaweiDescription.ItemNumber
WHERE (DropshipPackinglist.BatchCode LIKE '%0005041007100AHWA11HG')
-------------------------------------------------------------------------------------------
Result:
CaseNumber ItemNumber Quantity TotalVolume
1 52411573 5 1090x720x350
1 52411576 20 1090x730x1000
2 52411576 36 1090x730x1460
-------------------------------------------------------------------------------------------
Now is, i want to group casenumber and result with only one totalvolume.
And the result will be this one.
CaseNumber ItemNumber Quantity TotalVolume
1 52411573 5 1090x730x1230 -- sum(casenumber 1)=25
1 52411576 20 1090x730x1230 --
2 52411576 36 1090x730x1460
How to solve this one..thanks in regards.