【问题标题】:Get the latest time between two timestamp with time zone获取两个带有时区的时间戳之间的最新时间
【发布时间】:2021-02-04 01:30:09
【问题描述】:

在 psql 中,我想获取两列 time1 和 time2 的每一行中的最新时间,并创建一个新列,其中从 time1 和 time2 中选择最新时间。

【问题讨论】:

  • edit您的问题(通过点击下面的edit链接)并添加一些示例数据和基于该数据的预期输出为formatted text .请参阅here,了解有关如何创建漂亮的文本表格的一些提示。 (edit 您的问题 - 请不要在 cmets 中添加代码或其他信息)

标签: postgresql timestamp


【解决方案1】:

应该是这样的

SELECT greatest(time1, time2) AS newcol
FROM ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-26
    • 2012-04-09
    • 2014-05-22
    • 2018-05-29
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    • 2016-11-20
    相关资源
    最近更新 更多