MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Comparison using Date type function?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
cappertan
Beginner


Joined: 20 May 2003
Posts: 15
Topics: 10

PostPosted: Thu Sep 02, 2004 7:50 am    Post subject: Date Comparison using Date type function? Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Sep 02, 2004 8:45 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
cappertan
Beginner


Joined: 20 May 2003
Posts: 15
Topics: 10

PostPosted: Thu Sep 02, 2004 9:33 am    Post subject: Reply with quote

Thanks Kolusu. I will give it a go.
_________________
Capp
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group