-- 1. This statement is equivalent to a Left join statement. The where clause is the number of updates.
-- Note! If the number of rows in the table (obtained after where) is smaller than that in the outer table (obtained after where), a record that does not meet the = condition will be assigned a null value.
-- If NULL values are not incorrectly assigned, AN in (select...) must be added to the External table to force the records of the internal and external tables to be consistent.
- UPDATEPatient
- SETForeignName = (
- SELECTForeignName_New
- FROMPatient_YNG
- WHEREPatient. PatientID = patient_yng.PatientID
- )
- WHEREPatient. ClinicID = 1483
- ANDPatient. PatientIDIN(SELECTPatientid
- FROMPatient_YNG)
-- 2. This method is easy and error-prone.
- UPDATEPatient
- SETForeignName = ForeignName_New
- FROMPatient_YNG
- WHEREPatient. PatientID = patient_yng.PatientID
- ANDPatient. ClinicID = 1483