我有一个 Postres 数据库,想比较两个时间戳字段。
基本查询:
select t1.valu1, t1.valu2 from table1 as t1 where t1.valu1 == t1.valu2
通过时间戳比较:
select t1.valu1, t1.valu2 from table1 as t1
where EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE t1.valu1 )
== EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE t1.valu2 )
的样本值valu1
:
'14:50:15'
,'10:50:15'
valu2
:
'11:10:15'
, '17:50:15'
我想将valu1
和转换valu2
为时间戳并在之后进行比较。
// syntax of extract
EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '20:38:18');
我收到以下格式的错误:
EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE t1.valu2 )