//获取两行之间的时间差,并转换成分钟
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
原文:https://www.cnblogs.com/indexlang/p/12219520.html