Hi,
I have an aggregated table called T1 which looks like this:
Code:
Name Amount
a 10
b -4
c 9
d 5
e 0
f 0
g 8
h 3
i 3
I need to write a query which selects the top 3 names by amount which have an amount greater than 0.
The remaining names which have amounts greater than 0 should be grouped together as 'others' at the bottom. Finally I need to add a total row. So the final result I am looking for is:
Code:
Name Amount
a 10
c 9
g 8
others 11
total 38
The part I'm struggling with is how to collapse the remaining names into the 'others' group. Please would someone give me an outline of the best way to go about this?
Thanks