SQL query to return columns per value in value range?
I used the basis of a pivot table query on StackOverflow. Here is a similar post to the one that I used in my query below. Here is a more general link for pivot tables.

SELECT [Range]
       ,[0-20000]=ISNULL(SUM([0-20000]),0)
       ,[20001-21000]=ISNULL(SUM([20001-21000]),0)
       ,[21001-22000]=ISNULL(SUM([21001-22000]),0)
       ,[22001-23000]=ISNULL(SUM([22001-23000]),0)
       ,[23001-24000]=ISNULL(SUM([23001-24000]),0)
FROM (
    SELECT  CASE     WHEN Value2 BETWEEN 0 AND 70 THEN 'a 0-70'
                     WHEN Value2 BETWEEN 71 AND 90 THEN 'b 71-90'
                     WHEN Value2 BETWEEN 91 AND 110 THEN 'c 91-110'
                     WHEN Value2 BETWEEN 111 AND 130 THEN 'd 111-130'
                     WHEN Value2 BETWEEN 131 AND 150 THEN 'e 131-150'
                     WHEN Value2 BETWEEN 151 AND 170 THEN 'f 151-170'
                     ELSE 'Over 170' END AS Range,
                    *
     FROM 
        (SELECT     value2,
                    Range2 AS [Value],
                    COUNT(*)  AS Foo
        FROM    (SELECT 
        value2,
        CASE WHEN Value1 BETWEEN 0 AND 20000 THEN '0-20000'
                     WHEN Value1 BETWEEN 20001 AND 21000 THEN '20001-21000'
                     WHEN Value1 BETWEEN 21001 AND 22000 THEN '21001-22000'
                     WHEN Value1 BETWEEN 22001 AND 23000 THEN '22001-23000'
                     WHEN Value1 BETWEEN 23001 AND 24000 THEN '23001-24000'
                     ELSE 'Over 24000' END AS Range2
                FROM    (SELECT value1,value2
                         FROM StackDBA) AS derivedtbl_1) AS t
        GROUP BY Range2, value2) q1
        pivot
        (max(foo)
         for [value] in ([0-20000],[20001-21000],[21001-22000],[22001-23000],[23001-       24000])
        )as pvt
) grp

GROUP BY [Range]


SQL Fiddle