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?
gbritton1
SSCertifiable
Points: 6522
More actions
May 1, 2014 at 9:52 am
#1710138
check out Windowing functions. Something like:
select count(*) over (partition by city) citycount
, count(*) over (partition by state) statecount
...