I'm trying to get a grand total for three columns but have been unable to get it to work. When I try group by rollup it adds lots of extra lines and when I try group by grouping set it doesn't seem to work either. What am I doing wrong? Thanks.
SELECT COALESCE(CATEGORY_DESCRIPTION,'TOTAL_DOLLARS') AS CATEGORY_DESCRIPTION
,PY_UNITS
,SUM(PY_COST) AS PY_COST
,PY_MEMBERS
,CUR_UNITS
,SUM(CUR_COST) AS CUR_COST
,CUR_MEMBERS
,PM_UNITS
,SUM(PM_COST) AS PM_COST
,PM_MEMBERS
FROM FINAL
GROUP BY ROLLUP (CATEGORY_DESCRIPTION
,PY_UNITS
,PY_MEMBERS
,CUR_UNITS
,CUR_MEMBERS
,PM_UNITS
,PM_MEMBERS)
question from:https://stackoverflow.com/questions/65601663/group-by-rollup-certain-columns