Hey guys,
I can't figure out why my query is giving me errors. I'm trying to find people who are age 62 or older.
I'm getting use of reserve word GROUP is not valid. The query works fine if I take out the line where I'm searching for age. Here is my query:
Code:
SELECT E.CTY_ID_NM,
count(*) as COUNT
FROM DSNP.PR01_T_MBR_SYS A,
DSNP.PR01_T_MBR B,
DSNP.PR01_T_MBR_CITY C,
DSNP.PR01_T_ZIP D,
DSNP.PR01_T_CTY E
WHERE A.MBR_SSN_NBR=B.MBR_SSN_NBR
AND A.MBR_SSN_NBR=C.MBR_SSN_NBR
AND C.POST_ZIP_CD=D.POST_ZIP_CD
AND D.CTY_ID_CD=E.CTY_ID_CD
AND A.MBR_STAT_CD = '1'
and ((YEAR(CURRENT DATE) - YEAR(b.mbr_BIRTH_DT) >= 62)
group by E.CTY_ID_NM
Any ideas?