首页 > 数据库技术 > 详细

postgresql 两行数据时间之差

时间:2020-01-20 21:54:01      阅读:136      评论:0      收藏:0      [点我收藏+]

//获取两行之间的时间差,并转换成分钟

1 select *,extract(epoch from((aaa."ar"::timestamp) - (bbb."br"::timestamp)))/60 as counterDiffer from 
2 (select row_number() OVER (ORDER BY "ID") as aa,"ReceiveTime" as ar from public."YourTableName" where "searchID" = 123456) as aaa,
3 (select row_number() OVER (ORDER BY "ID") as bb,"ReceiveTime" as br from public."YourTableName" where "searchID" = ‘123456) as bbb 4 where aa -1 =bb order by ar

 

postgresql 两行数据时间之差

原文:https://www.cnblogs.com/indexlang/p/12219520.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!