I am trying to write a query to count the various groupings from a resultset. I can see how to do it with a cursor, but is it possible to use the Partition By command too please? Basically, anything with better performance than a cursor.
Data:
Name Entity Status
---------------------------
Bob Car Broken
Bob Car Broken
Bob Car Fixed
Bob Car Stolen
Bob Bike Fixed
Bob Bike Fixed
Bob Bike Fixed
Bob Bike Stolen
Dave Scooter Broken
Dave Car Broken
Dave Car Fixed
Dave Car Stolen
Report:
Name Entity Broken Fixed Stolen
------------------------------------------
Bob Car 2 1 1
Bob Bike 0 3 1
Dave Scooter 1 0 0
Dave Car 1 1 1
Thanks