当前位置:   article > 正文

PgSQL的with as语法

PgSQL的with as语法

 returning 返回的这一些字段,然后进行汇总为remove_alarms 

然后select一下remove_alarms 出来的数据然后保存到tb_alarm_his 里面

  1. with remove_alarms as(
  2. delete
  3. from
  4. tb_alarm
  5. where
  6. id in ('508')
  7. returning
  8. 0,
  9. now(),
  10. 'admin',
  11. alarmadvice,
  12. alarmadvicecn,
  13. alarmarisestimestamp,
  14. alarmclass,
  15. alarmid,
  16. alarmlevel,
  17. alarmname,
  18. alarmnamecn,
  19. alarmreason,
  20. alarmreasoncn,
  21. alarmsequence,
  22. currentvalue,
  23. detail,
  24. ifservicelive,
  25. locationinfo1,
  26. locationinfo2,
  27. nodeip,
  28. nodename,
  29. nodeport,
  30. podname,
  31. restartreply,
  32. servicename,
  33. sourceservice,
  34. thresholdvalue,
  35. tenant,
  36. confirmstatus,
  37. confirmer,
  38. alarmconfirmtimestamp)
  39. insert
  40. into
  41. tb_alarm_his (alarmtype,
  42. alarmrecovertimestamp,
  43. cleaner,
  44. alarmadvice,
  45. alarmadvicecn,
  46. alarmarisestimestamp,
  47. alarmclass,
  48. alarmid,
  49. alarmlevel,
  50. alarmname,
  51. alarmnamecn,
  52. alarmreason,
  53. alarmreasoncn,
  54. alarmsequence,
  55. currentvalue,
  56. detail,
  57. ifservicelive,
  58. locationinfo1,
  59. locationinfo2,
  60. nodeip,
  61. nodename,
  62. nodeport,
  63. podname,
  64. restartreply,
  65. servicename,
  66. sourceservice,
  67. thresholdvalue,
  68. tenant,
  69. confirmstatus,
  70. confirmer,
  71. alarmconfirmtimestamp)
  72. select
  73. *
  74. from
  75. remove_alarms

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/437557
推荐阅读
相关标签
  

闽ICP备14008679号