returning 返回的这一些字段,然后进行汇总为remove_alarms 文章来源:https://www.toymoban.com/news/detail-845395.html
然后select一下remove_alarms 出来的数据然后保存到tb_alarm_his 里面文章来源地址https://www.toymoban.com/news/detail-845395.html
with remove_alarms as(
delete
from
tb_alarm
where
id in ('508')
returning
0,
now(),
'admin',
alarmadvice,
alarmadvicecn,
alarmarisestimestamp,
alarmclass,
alarmid,
alarmlevel,
alarmname,
alarmnamecn,
alarmreason,
alarmreasoncn,
alarmsequence,
currentvalue,
detail,
ifservicelive,
locationinfo1,
locationinfo2,
nodeip,
nodename,
nodeport,
podname,
restartreply,
servicename,
sourceservice,
thresholdvalue,
tenant,
confirmstatus,
confirmer,
alarmconfirmtimestamp)
insert
into
tb_alarm_his (alarmtype,
alarmrecovertimestamp,
cleaner,
alarmadvice,
alarmadvicecn,
alarmarisestimestamp,
alarmclass,
alarmid,
alarmlevel,
alarmname,
alarmnamecn,
alarmreason,
alarmreasoncn,
alarmsequence,
currentvalue,
detail,
ifservicelive,
locationinfo1,
locationinfo2,
nodeip,
nodename,
nodeport,
podname,
restartreply,
servicename,
sourceservice,
thresholdvalue,
tenant,
confirmstatus,
confirmer,
alarmconfirmtimestamp)
select
*
from
remove_alarms
到了这里,关于PgSQL的with as语法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!