Repeating a query across columns
Posted on 2008-10-02
I have this query which works fine and gives me the data I'm looking for exactly.
SELECT COUNT(DATEDIFF(Day,SLA_Date,GetDate())) AS [0 TO 30 Days]
WHERE Addinfo >= 500 AND CurrentStatus = 'OPEN' AND DATEDIFF(Day,SLA_Date,GetDate()) BETWEEN 0 AND 30
However, I need to have the same query for BETWEEN 31 AND 60 and BETWEEN 61 and 90 etc.. I want to be able to run the query so that I get 3 columns one named 0 to 30 days, one named 31 to 60 days etc.. I just don't know how to repeat the query in the same results.