I have a table SalesDetails with the following schema:
CustomerID TotalDue ShippingAdress
1 100 aaa
1 200 aaa
1 300 bbb
2 100 ccc
2 400 ddd
2 700 ccc
And I I need a query that will surmise the above table into a new table with the following schema:
CustomerID SumDue ShippingAdress
1 300 aaa
1 300 bbb
2 800 ccc
2 400 ddd
Currently I am using a 'Group By' on the CustomerID and SUM 'TotalDue'. But I do not know how to conditionally sum the TotalDue based on both CustomerID and ShippingAddress.
Any help would be much appreciated.