我试图将时间戳转换为时间,但它不起作用。它说
ERROR:由于内部错误,不支持这种类型的相关子查询模式。
如此:
,CAST(regdate as timestamp) as "Date"
但是如果我做了
,CAST(regdate as time) as "Time"
给出错误。
I tried also do
CASt(CAST(regdate as timestamp) as time)
但仍然错误…
regdate is "timestamp without time zone)
任何建议吗?
如果您只想从时间戳字段中提取时间部分,您可以使用TO_CHAR函数来实现它
使用日期时间格式字符串来实现您想要的结果。https://docs.aws.amazon.com/redshift/latest/dg/r_FORMAT_strings.html
查询# 1
select to_char(timestamp '2009-12-31 23:15:59', 'HH24:MI:SS');
<表类>to_char tbody><<tr>23:15:59 表类>