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 

Add DAte, year and Month Columns of Db2

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


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Thu Apr 16, 2009 11:58 pm    Post subject: Add DAte, year and Month Columns of Db2 Reply with quote

Hi,

Is it possible to write a Query to add few columns of a DB2 table where in First column is a date, second is years and third is Months?

Here is the data from table:
Code:

EXT_DATE                   EXT_YEARS                EXT_MONTHS

2002-12-02                        2                            0

2004-01-12                        1                            1



Result expected is ( EXT_DATE + EXT_YEARS+EXT_MONTHS).

Based on the data above, expected result is

2004-12-02 and 2005-02-12

Thanks
Novice
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Apr 17, 2009 10:16 am    Post subject: Reply with quote

Novice,

Hmm unless this is a trick question, I don't see why you can't simply add them up?

Code:

SELECT EXT_DATE + EXT_YEARS YEARS + EXT_MONTHS MONTHS
  FROM table


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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