SELECT
CASE WHEN MONTH(A.BILL_DT)>=7 THEN
CONCAT(YEAR(A.BILL_DT),YEAR(A.BILL_DT)+1)
ELSE CONCAT(YEAR(A.BILL_DT)-1, YEAR(A.BILL_DT)) END AS FY,
SUM(A.BILL_AMT)
FROM REVADMIN.REV_BILL_HEADER A
GROUP BY FY
Why I am getting error like this FY: invalid identifier
You'll have to
group bythe wholecaseexpression, not its alias.Note that you can't literally copy/paste "everything", using alias as it won't work either; for example: