postgresql 两行数据时间之差
Posted indexlang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postgresql 两行数据时间之差相关的知识,希望对你有一定的参考价值。
//获取两行之间的时间差,并转换成分钟
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 两行数据时间之差的主要内容,如果未能解决你的问题,请参考以下文章
为 PostgreSQL 函数调用获取“范围内”的两行:交叉连接?