MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Novice Beginner Joined: 27 Dec 2002 Posts: 46 Topics: 15
Posted: Thu Apr 16, 2009 11:58 pm Post subject: Add DAte, year and Month Columns of Db2
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Fri Apr 17, 2009 10:16 am Post subject:
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
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