且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在postgresql选择中,将timestamp列添加到another_days列

更新时间:2023-11-30 23:38:04

您可以将整数添加到日期,但没有时间戳

You can add integers to a date but not to a timestamp.

您只能将 interval 添加到时间戳值,因此需要将整数值转换为间隔1天:

You can only add an interval to a timestamp value, so you need to "convert" the integer value to an interval of 1 day:

select name, title, create_dtm + interval '1' day * wait_days
from the_table;

SQLFiddle示例: http://sqlfiddle.com/#!15/891f5/1

SQLFiddle example: http://sqlfiddle.com/#!15/891f5/1

(下次请发布您收到的错误消息)

(The next time, please post the error message you get)