首页 > 其他 > 详细

窗口函数更新

时间:2021-02-25 18:07:46      阅读:41      评论:0      收藏:0      [点我收藏+]
update ex_port_inspection
set authority = rt.authority, port_name=rt.port_name
from (
SELECT lag(rid, -1) over(partition by imo order by report_date desc) as pre_rid,*
from ex_port_inspection
where imo =‘8710156‘
order by imo,report_date desc
) rt
where ex_port_inspection.imo =‘8875061‘
and (ex_port_inspection.port_name is null or ex_port_inspection.port_name=‘‘)
and ex_port_inspection.rid = rt.pre_rid

窗口函数更新

原文:https://blog.51cto.com/10705830/2637458

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