[英]How to add Days from a column to a current Date in DB2?
I am writing this sql to dynamically calculate certain number of days as below. 我正在编写这个sql来动态计算如下的特定天数。 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 ? 通常所有的指南都会显示当前日期+ 1天的例子(这有效但不是上面的那些)任何想法我怎样才能让它起作用?
select Current Date + Dynamic numbr DAYS FROM TableName 选择当前日期+ 动态数字 DAYS FROM TableName
eg 例如
select Current Date + 15 DAYS from TableName
here 15 is dynamic number. 这里15是动态数字。
SELECT CURRENT_DATE + (your dynamic numeric field) DAYS FROM FILE_NAME
Example based on AS400: 基于AS400的示例:
1) 1)
SELECT CURDATE() + (FLDA) DAYS FROM FILEA
2) 2)
SELECT CURDATE() + 8 DAYS FROM FILEA
Try this 试试这个
SELECT
DATE(DTE_BILL_EFFCTV - 301 DAYS)
FROM BILL_ACCT
WHERE
DTE_BILL_EFFCTV > DATE(CURRENT DATE - 300 DAYS) ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.