gpt4 book ai didi

amazon-redshift - redshift datediff 在使用 current_timestamp 时不起作用,但在使用 getdate() 函数时起作用

转载 作者:行者123 更新时间:2023-12-04 19:00:04 25 4
gpt4 key购买 nike

我正在查询带有 datediff 的时间戳列 current_timestamp .但它给出了错误。

DATEDIFF(minute, timestamp_field ,current_timestamp::TIMESTAMP) 
or
DATEDIFF(minute, timestamp_field ,current_timestamp)
DataType of timestamp_field is "TIMESTAMP DEFAULT '2016-03-29 20:33:33.404256'::timestamp without time zone"

输出:

ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables.

Warnings: Function ""timestamp"(timestamp with time zone)" not supported. Function "timestamptz(timestamp with time zone,integer)" not supported. Function "timestamptz(text)" not supported.



但是如果我使用 ,下面的查询是有效的getdate() 功能
DATEDIFF(minute, timestamp_field ,getdate()::TIMESTAMP)

最佳答案

我只是简单地将带时区的时间戳转换为时间戳并且它正在工作。

例子:

select datediff(min, CURRENT_TIMESTAMP::timestamp, CURRENT_TIMESTAMP::timestamp);

关于amazon-redshift - redshift datediff 在使用 current_timestamp 时不起作用,但在使用 getdate() 函数时起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39702308/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com