开发者

Adding days to a date

I am have a column of dates that I need to add a variable amount of days to. So I don't think I can use the normal date_add (date, interval x day).

date          numOfDays
2001-01-01        5
2001-05-22开发者_开发百科        3
2002-03-04        2
...               ...

I'm basically looking for something like:

select date, numOfDays, (date + numOfDays) as newDate
from t1;


SELECT `date`,
       `numOfDays`,
       (`date` + INTERVAL `numOfDays` DAY) AS `newDate`
  FROM `t1`;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜