I am having an error on the column "PREMIUM" when the premium exist on the select statement. I am not sure what I am doing wrong.
SELECT QUIKPLAN.FORMS, COALESCE(NEWQUIKVALF1.MVALDATE, '2022-09-30') AS ReportDate, ISNULL((SUM(NEWQUIKVALF1.MANNLZD)/12),0) AS PREMIUM
FROM QUIKPLAN
LEFT JOIN dbo.NEWQUIKVALF1 ON QUIKPLAN.NEWPLAN=NEWQUIKVALF1.NPLAN
GROUP BY QUIKPLAN.FORMS, NEWQUIKVALF1.MVALDATE
HAVING ((QUIKPLAN.FORMS)='L-4054' and ((PREMIUM)>1))
This code works in Snowflake, but it is not working in SQL Server. Thanks for your help.