group by top n values
There are plenty solutions how to group by top n values but I look for one step more. I also want to sum all other groups and add it as n+1 value.
To clarify simple example below:
To clarify simple example below:
select letter, count(*) from some_text group by letter
A 100
B 120
C 3
D 280
E 2
F 1
G 300
above is result of simple query which groups by "Letters" . What I would like to do is to present top 4 values and add a fifth value something like "others_letters"
A 100
B 120
D 280
G 300
other_letters 6
any hints ?
regards
K.
0