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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Calculation

Status
Not open for further replies.

2122002

IS-IT--Management
Apr 22, 2003
58
US
Hi all,

I have a field name "DonDate" with this date format MM/DD/YYYY HH:MI:SS AM.

Example:


Name | Sex | DonDate
---------------------
James |M | 08/08/2005
Juliet |F | 03/02/2004
Good |M | 01/01/2005
Armand |M | 09/09/2005

How do I know list of people who have not donate within the last 6 months?.

Thank you.


 

Maybe you could use the ADD_MONTHS(<date>,<number>) function to test the date differential.
[ponder]

Example: dondate < ADD_MONTHS(TRUNC(SYSDATE,-6))


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Is you DonDate a date or varchar field?

If it is varchar do this

WHERE
to_date(dondate, 'MM/DD/YYYY HH:MI:SS AM') > add_months(trunc(sysdate), -6)


If the DonDate is a date datatype do this

WHERE dondate > add_months(trunc(sysdate), -6)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top