将架构表数据更新到另一个架构表

时间:2017-04-12 06:07:31

标签: postgresql

我有一个函数,输入参数在将数据插入xch.xch_transmas_patient表后将数据插入xch.xch_transmas_patient表我试图通过编写更新语句将数据更新到lt_transmas_patient表中并且我已经写了我在func中的代码是这样的正确与否

UPDATE lt_transmas_patient p 

        SET patient_first_name=pa.patient_first_name,
        patient_last_name=pa.patient_last_name,
        patient_birthdate=pa.patient_birthdate,
        patient_email=pa.patient_email,
        patient_mobile=pa.patient_mobile,
        patient_home_phone=pa.patient_home_phone,
        patient_updated_by=pa.patient_created_by,
        patient_updated_on=pa.patient_updated_on,
        patient_salutation=pa.patient_salutation,
        patient_maritalstatus=pa.patient_maritalstatus,
        patient_education_level=pa.patient_education_level,
        patient_blood_group=pa.patient_blood_group,
        patient_mother_tongue=pa.patient_mother_tongue,
        patient_identification_mark=pa.patient_identification_mark

        FROM xch.xch_transmas_patient pa
        join xch.xch_transmasmap_mpi_link m on m.mpi_lk_xch_mpi=pa.patient_mpi and m.mpi_lk_partner_id=2
        where p.patient_mpi=m.mpi_lk_external_mpi
        and pa.patient_mpi=_patient_mpi;

0 个答案:

没有答案