我正在尝试在SQL Server中使用group by rollup
对除行中的所有行进行总计。我得到以下内容对所有列均正确,但我想删除RTF Total-224549.33。是否有一种在group by rollup
中包含case语句的方法,或者我可以通过其他什么方式使该行不计算在内?谢谢。
SELECT PARENT
,CASE WHEN CATEGORY_DESCRIPTION = '071 - RTF TOTAL' THEN RIGHT(CATEGORY_DESCRIPTION,9) ELSE CATEGORY_DESCRIPTION END AS CATEGORY_DESCRIPTION
,SUM(JANUARY) AS JANUARY
,SUM(FEBRUARY) AS FEBRUARY
,SUM(MARCH) AS MARCH
,SUM(APRIL) AS APRIL
,SUM(MAY) AS MAY
,SUM(JUNE) AS JUNE
,SUM(JULY) AS JULY
,SUM(AUGUST) AS AUGUST
,SUM(SEPTEMBER) AS SEPTEMBER
,SUM(OCTOBER) AS OCTOBER
,SUM(NOVEMBER) AS NOVEMBER
,SUM(DECEMBER) AS DECEMBER
FROM T2
GROUP BY ROLLUP (PARENT,CATEGORY_DESCRIPTION)