当我从 redshift 选择 current_timestamp
时,我得到了一个值列表而不是一个值。
这是我的 SQL 查询
select current_timestamp
from stg.table;
有人知道为什么我得到的是值列表而不是单个值吗?
最佳答案
这是您的查询:
select current_timestamp from stg.table
这会产生与表 stg.table
中一样多的行(因为那是 from
子句),其中一列始终包含当前日期/时间在每一行。另一方面,如果表不包含任何行,则查询不返回任何行。
如果您只需要一行,请使用不带 from
子句的标量子查询:
select current_timestamp as my_timestamp
关于sql - 当前时间戳 Redshift ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63476610/