SQL query to return a column per value in value range?
SELECT CAST(YEAR(date) AS VARCHAR(4)) + '-' + CAST(MONTH(date) AS VARCHAR(2)) AS Date
    , [0-19000] = COUNT(CASE WHEN Value&lt;=19000 THEN 1 END)
    , [19000-20000] = COUNT(CASE WHEN Value &gt; 19000 and Value&lt;=20000 THEN 1 END)
    , [20000-21000] = COUNT(CASE WHEN Value &gt; 20000 and Value&lt;=21000 THEN 1 END)
    , [21000-22000] = COUNT(CASE WHEN Value &gt; 21000 and Value&lt;=22000 THEN 1 END)
    , [22000-23000] = COUNT(CASE WHEN Value &gt; 22000 and Value&lt;=23000 THEN 1 END)
    , [23000-24000] = COUNT(CASE WHEN Value &gt; 23000 and Value&lt;=24000 THEN 1 END)
FROM [SomeTable]
GROUP BY CAST(YEAR(date) AS VARCHAR(4)) + '-' + CAST(MONTH(date) AS VARCHAR(2))