窗口函数更新
作者:互联网
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
标签:rt,窗口,函数,更新,ex,rid,imo,inspection,port 来源: https://blog.51cto.com/10705830/2637458