View previous topic :: View next topic |
Author |
Message |
cappertan Beginner
Joined: 20 May 2003 Posts: 15 Topics: 10
|
Posted: Thu Sep 02, 2004 7:50 am Post subject: Date Comparison using Date type function? |
|
|
I am looking for an example to a query to find
ID's where the UPDATE_DT >= CONTACT_DT.
contact_dt is defined as YYYY-MM-DD
up_dt is defined as yyyy-MM-DD HH:MM:SS.
Example:
Select *
from test.mytable
where UPDATE_DT >= CONTACT_DT
and UPDATE_DT >= Today
update date = 2004-09-01 18:00:00
Contact date = 2004-08-31
DO I substring the date in the where clause? Use A Cast function
I looked in the SQL manual but did not see
anything giving me a clue.
Suggestions please. _________________ Capp |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Sep 02, 2004 8:45 am Post subject: |
|
|
cappertan,
Try this
Code: |
Select *
from test.mytable
where SUBSTR(UPDATE_DT,1,10) >= CONTACT_DT
and SUBSTR(UPDATE_DT,1,10) >= CURRENT DATE
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
cappertan Beginner
Joined: 20 May 2003 Posts: 15 Topics: 10
|
Posted: Thu Sep 02, 2004 9:33 am Post subject: |
|
|
Thanks Kolusu. I will give it a go. _________________ Capp |
|
Back to top |
|
 |
|
|