Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Equal to Less Than or Equal?

Status
Not open for further replies.

lrdave36

Technical User
Jan 6, 2010
77
US
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:


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?
 
Not less than or equal to" is the same as "Greater than".

So it should be as simple as:

retire_dt2 > '2009-01-01'



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top