SQL Server aggregated report example

An example of how to make an aggregated report, grouping together by values:


    select  count(*) as total ,
        count(case WHEN others = 1 THEN 1 END)    as [one url],
        count(case WHEN others = 2 THEN 1 END)    as [two urls],
        count(case WHEN others = 3 THEN 1 END)    as [three urls],
        count(case WHEN others > 3 THEN 1 END)    as [all the rest]
        from #temp2
«September»
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456