Home Forums SQL Server 2012 SQL 2012 - General Is there a fast way for SQL to do a Group By Count on items within a group? RE: Is there a fast way for SQL to do a Group By Count on items within a group?

  • check out Windowing functions. Something like:

    select count(*) over (partition by city) citycount

    , count(*) over (partition by state) statecount

    ...