我的表中有时间戳,我只想从中提取小时.我搜索并找到了提取函数,但无法用作查询.我是否需要将第一个时间戳转换为varchar,然后从其中提取小时? 以下是我的问题:
select extract(hour from timestamp '2001-02-16 20:38:40') // example
实际查询:
select extract(hour from timestamp observationtime) from smartvakt_device_report
我的表中有时间戳,我只想从中提取小时.我搜索并找到了提取函数,但无法用作查询.我是否需要将第一个时间戳转换为varchar,然后从其中提取小时? 以下是我的问题:
select extract(hour from timestamp '2001-02-16 20:38:40') // example
实际查询:
select extract(hour from timestamp observationtime) from smartvakt_device_report
下面的方法应该是可行的
select extract(hour from observationtime) from smartvakt_device_report