1、去除重复语句
delete from ZS_PC_DJWD a where (a.ST_DATE,a.MAX_VALUE,a.DEVICE_CODE) in (select ST_DATE,MAX_VALUE,DEVICE_CODE from ZS_PC_DJWD group by ST_DATE,MAX_VALUE,DEVICE_CODE having count(*) > 1) and rowid not in (select min(rowid) from ZS_PC_DJWD group by ST_DATE,MAX_VALUE,DEVICE_CODE having count(*)>1)
2、更新时间
merge into AIRPRESSURE_PRE r using (select a.order_id,start_time+(b.id-1)*1/24/60 process_time,time from (select order_id,start_time from order_info where order_id = ‘%s‘) a, (select order_id,time,ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY time) id from AIRPRESSURE_PRE where order_id = ‘%s‘ ) b where a.order_id = b.order_id) t on (r.order_id = t.order_id and r.time = t.time) when matched then update set r.time_new = t.process_time"%(order_id,order_id)
原文:https://www.cnblogs.com/xxupup/p/12105695.html