postgres 不存在则插入

    $query = "insert into inspectionunit(inspectionunitid,inspectionunitname)
    select '$inspectionunitid','$unitname' from (select 1) tmp where not
    exists  (select 1 from inspectionunit where inspectionunitname='$unitname')";
posted @ 2021-07-03 15:02  青柚  阅读(165)  评论(0编辑  收藏  举报