select
push_id AS pushId,
device_id AS deviceId,
"timestamp" AS statusTime,
status_type AS statusType
from (
select ROW_NUMBER() over(partition by status_type order by "timestamp" desc nulls last) RowNum
,pamip_status.*
from pamip_status where push_id ='57c792ad67dc4ec3612da00c' )t where rownum =1
push_id AS pushId,
device_id AS deviceId,
"timestamp" AS statusTime,
status_type AS statusType
from (
select ROW_NUMBER() over(partition by status_type order by "timestamp" desc nulls last) RowNum
,pamip_status.*
from pamip_status where push_id ='57c792ad67dc4ec3612da00c' )t where rownum =1
本文介绍了一种使用SQL查询来获取特定推送ID下最新的状态记录的方法。通过使用窗口函数ROW_NUMBER()并结合PARTITION BY和ORDER BY子句,可以有效地从数据库中筛选出每个状态类型的最后一条记录。
1420

被折叠的 条评论
为什么被折叠?



