I am trying to write a query which produces a summary or statuses but my current attempt is ugly and takes too long (over a minute).
Given this sample data:
I want to produce this summary data:
How can I write this query so that it can stay fast and flexible?
Assuming your status values don't change you can use PIVOT:
answered Feb 12, 2010 at 05:12 PM