Need advice on case statement to replace union all
Want to implement case and remove union all
SELECT
,[MONTH]
,[YEAR]
,[A]
,[B]
,[C]
,[D]
,[E]
,'HELLO' as STRING1
,'HI' AS STRING2
,SUM(E) as metric1
,SUM(D) AS metric2
NULL AS RATE
FROM TAB D1,
TABLE D2 WHERE (D2.[A]= D1.[A])
group by
[MONTH]
,[YEAR]
,[A]
,[B]
,[C]
,[D]
,[E]
UNION ALL
SELECT
,[MONTH]
,[YEAR]
,[A]
,[B]
,[C]
,[D]
,[E]
,'HELLO' as STRING1
,'HI' AS STRING2
,SUM(B) as metric1
,SUM(C) AS metric2
NULL AS RATE
FROM TAB D1,
TABLE D2 WHERE (D2.[A]= D1.[A])
group by
[MONTH]
,[YEAR]
,[A]
,[B]
,[C]
,[D]
,[E]
Mudassar