Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 -difference between two dates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
aimprabhu

New User


Joined: 12 Aug 2008
Posts: 11
Location: chennai

PostPosted: Mon Oct 13, 2008 6:30 pm    Post subject: DB2 -difference between two dates
Reply with quote

Hi Please give a sugestion.I have to run query which gives difference between two dates.

It is not diff between timestamp.

Eg:

Table A Table B

D1 D1

How can we find the difference between the total no.of days
Back to top
View user's profile Send private message

hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Mon Oct 13, 2008 7:34 pm    Post subject: Reply to: DB2 -difference between two dates
Reply with quote

Hi,

try using the query below:

SELECT TableA.D1 - TableB.D1
FROM TableA , TableB ;

Ex:

SELECT CURRENT_DATE - '2008-10-10'
FROM SYSIBM.SYSDUMMY1 ;


Thanks,
-Kapil.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Oct 14, 2008 12:38 am    Post subject:
Reply with quote

Hello,

Quote:
SELECT TableA.D1 - TableB.D1
FROM TableA , TableB ;
Did you test this?

Please post the result of your test. . .
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Oct 14, 2008 10:17 am    Post subject: Reply to: DB2 -difference between two dates
Reply with quote

Hi,
This will give you the difference between the two dates.
SELECT DAYS('10/10/2008') - DAYS('10/05/2008')
FROM SYSIBM.SYSDUMMY1
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us