Given a table of the following form
CustumerID | Amount
-------------------
1 | 100
1 | 50
2 | 30
3 | 40
4 | 50
the SQL query
SELECT SUM(Amount)
GROUP BY Customer ID
will return
CustomerID | Amount
-------------------
1 | 150
2 | 30
3 | 40
4 | 50
Is there a way to 'coarsen' the GROUP BY statement such that CustomerIDs 1 and 2 and CustomerIDs 3 and 4 are grouped together, i.e. that a result like
CustomerID | Amount
---------------------
1,2 | 180
3,4 | 90
is returned?