How to group by with a special condition
If you wanted to do it by putting small groups into one bucket, instead of by a particular name pattern, you could use:
select (case when cnt > 100 then username else 'OTHER' end), sum(cnt) as cntfrom (select username, count(*) as cnt from host where seq between 0 and 2000 group by username ) tgroup by (case when cnt > 100 then username else 'OTHER' end)