Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Days from a column to a current Date in DB2?

Tags:

sql

db2

I am writing this sql to dynamically calculate certain number of days as below. But I don't know how to make it work because I keep getting the error.

select Current Date + ( Dynamic numbr of days calculation here ) from  TableName

Usually all the guides shows examples as Current Date + 1 Day (this works but not the above) Any ideas how can I get it to work from ?

like image 816
Njax3SmmM2x2a0Zf7Hpd Avatar asked Nov 21 '11 11:11

Njax3SmmM2x2a0Zf7Hpd


2 Answers

SELECT CURRENT_DATE + (your dynamic numeric field) DAYS FROM FILE_NAME

Example based on AS400:

1)

SELECT CURDATE() + (FLDA) DAYS FROM FILEA

2)

SELECT CURDATE() + 8 DAYS FROM FILEA
like image 90
Gokul Avatar answered Oct 04 '22 05:10

Gokul


select Current Date + Dynamic numbr DAYS FROM TableName

e.g.

select Current Date + 15 DAYS  from TableName

here 15 is dynamic number.

like image 32
kedar kamthe Avatar answered Oct 04 '22 05:10

kedar kamthe