Yeah a code example would have been a good start had I remembered to cut and paste it in. The case procedure looks like this:
WITH cte AS (SELECT DATEDIFF(YEAR, c.DOB1,GETDATE()) AS AGE FROM ClientsDetails c)
SELECT CASE WHEN cte.Age < 30 THEN '18-29'
WHEN cte.Age BETWEEN 30 AND 39 THEN '30-39'
[...]
ELSE '80+' END AS [Age],
COUNT(*) AS [Count]
FROM cte
GROUP BY CASE WHEN cte.Age < 30 THEN '18-29'
WHEN cte.Age BETWEEN 30 AND 39 THEN '30-39'
[...]
ELSE '80+'
So I get back "18-29, 6 - 30-39 55" ect.
Another report groups [ClientsDetails].Classification with table [Supply] and a SUM of 7 different fields in that table grouoped by classification. What I would like is to combine the CASE report to generate an age report that shows "18-29, 15455 - 30-39 22899" which is the AGE case, SUM with fields (1-7) from Supply. I've added in a SUM with a join but the group by tells me that it's not part of the aggregate function. It works in code but I would like to move it all back to SQL if possible.