How do I select the top 10 descending totals from a column (Amount) based on another column (ID)?
This is what I’d like my desired results to look like:
(Top 1)
Row 1: ID: 9, Amount: 10, Total: 15
Row 2: ID: 9, Amount: 5, Total: 15
(Top 2)
Row 3: ID: 500, Amount: 14, Total: 14
(Top 3)
Row 4: ID: 27, Amount: 3, Total: 9
Row 5: ID: 27, Amount: 3, Total: 9
Row 6: ID: 27, Amount: 3, Total: 9 etc.
Thanks.
if you need the final results to be ordered by sum(Amount) here is a query: