剑道第一仙

导航

Postgresql 时间相减

参考:https://blog.csdn.net/liubl2011/article/details/84079478

select (extract(epoch from cast(t.pgtime as timestamp))-extract(epoch from cast(t.inserttime as timestamp)))/60 as ddd 
from table_base t  -- 实体表
where (extract(epoch from cast(t.pgtime as timestamp))-extract(epoch from cast(t.inserttime as timestamp)))/60 > 120 -- pgtime大于inserttime 120分钟
limit 100;

 

posted on 2023-06-16 17:49  剑道第一仙  阅读(232)  评论(0)    收藏  举报