group by in sql combining values
sql, sql-server-2008
Solution
select
case when col1 in ('a','b') then col1 else 'other' end,
count(*)
from tab
group by case when col1 in ('a','b') then col1 else 'other' end
Problem
I have a table (sql 2008) with A,B,C,D,E values in col1 Is there a way to get counts grouped by col1 so that result returned will be ``` A - # B - # other - # ``` Thank you