Hey guys,
I'm stuck on how to code this query. Here's what I'm trying to do:
Pull records where the retire_dt2 date is not occuring before 01-01-2009. I tried this, but it failed:
How do I tell SQL to not include those less than or equal to 01-01-2009. Any ideas?
I'm stuck on how to code this query. Here's what I'm trying to do:
Pull records where the retire_dt2 date is not occuring before 01-01-2009. I tried this, but it failed:
Code:
SELECT Distinct A.RECIP_SSN_NBR,
STRIP(B.MBR_F_NM) CONCAT ' ' CONCAT (CASE WHEN B.MBR_M_NM = ' ' THEN '' ELSE B.MBR_M_NM CONCAT ' ' END) CONCAT STRIP(B.MBR_L_NM) AS NAME,
CHAR(A.RECIP_RETIR_DT,USA) AS "DROP EFFECTIVE DATE",
A.RECIP_RETIR_DT + 7 YEARS AS "DROP END DATE",
A.recip_retir_dt2
FROM DSNP.PR01_T_RECIP_SYS A,
DSNP.PR01_T_MBR B,
DSNP.PR01_T_MBR_HIST C
WHERE A.RECIP_SSN_NBR=B.MBR_SSN_NBR
AND A.RECIP_SSN_NBR=C.MBR_SSN_NBR
AND A.RECIP_RETIR_DT BETWEEN '2002-02-01' and '2009-01-31'
and not exists (select * from dsnp.pr01_t_recip_sys D
where a.mbr_ssn_nbr = d.mbr_ssn_nbr
and d.recip_retir_dt2 < '2009-01-01' )
How do I tell SQL to not include those less than or equal to 01-01-2009. Any ideas?