• If I understand correctly, you need something like this.

    SELECT SUM( CASE WHEN age BETWEEN 18 AND 25 THEN MyValue END) AS [18-25],

    SUM( CASE WHEN age BETWEEN 26 AND 35 THEN MyValue END) AS [26-35],

    SUM( CASE WHEN age BETWEEN 36 AND 45 THEN MyValue END) AS [36-45],

    SUM( CASE WHEN age > 45 THEN MyValue END) AS [18-25]

    FROM myTable

    Otherwise, you should post more details. Please read the article linked on my signature to find out how to get better help. 😉

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2