【问题标题】:How to add a number from a column to a date in postgres如何将列中的数字添加到postgres中的日期
【发布时间】:2018-06-15 01:37:41
【问题描述】:

我正在尝试做这样的事情

select myDate+addDays from myTable

myDate 是表中的日期时间列 addDays 是表中的整数列

【问题讨论】:

标签: postgresql-9.3


【解决方案1】:
select myDate + (interval '1' day * addDays) from myTable

上面的查询可以在 PostgreSQL 和 Oracle 上运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-14
    • 1970-01-01
    • 2023-02-09
    • 1970-01-01
    • 2021-08-11
    • 1970-01-01
    • 2022-06-15
    相关资源
    最近更新 更多