我的表中有时间戳,我只想从中提取一个小时。我搜索并找到一个提取功能,但无法用作查询。我是否需要在 varchar 中转换第一个时间戳,然后从中提取小时?这是我的查询:
select extract(hour from timestamp '2001-02-16 20:38:40') // example
实际查询:
select extract(hour from timestamp observationtime) from smartvakt_device_report
原文由 user526206 发布,翻译遵循 CC BY-SA 4.0 许可协议
以下应该工作