IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 -difference between two dates


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Tue Oct 14, 2008 12:38 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
Search our Forums:

Back to Top