CREATE CURSOR TableToUpdate (PK I, txt C(20)) INSERT INTO TableToUpdate VALUES (1, "One") INSERT INTO TableToUpdate VALUES (2, "Two") INSERT INTO TableToUpdate VALUES (3, "Three") CREATE CURSOR Updates (PK I, txt C(20)) INSERT INTO Updates VALUES (1, "1") INSERT INTO Updates VALUES (3, "3") * #1 * Test select to see wich records will be updated SELECT * ; FROM TableToUpdate JOIN Updates ON TableToUpdate.pk = Updates.pk * UPDATE itself UPDATE TableToUpdate SET txt = Updates.txt ; FROM TableToUpdate JOIN Updates ON TableToUpdate.pk = Updates.pk * #2 - The same as #1 but using table aliases SELECT * ; FROM TableToUpdate ttu JOIN Updates upd ON ttu.pk = upd.pk UPDATE ttu SET txt = upd.txt ; FROM TableToUpdate ttu JOIN Updates upd ON ttu.pk = upd.pk * #3 - Old style JOIN using WHERE clause. * A table alias cannot be used for table that has been updated. UPDATE TableToUpdate SET txt = Updates.txt ; FROM Updates WHERE TableToUpdate.pk = Updates.pk>Ok. Why is the FROM referencing the covr table? Logically it seems like it would be the patient table as that is where the update is coming from. Just trying to understand the logic of it.
>>update covr set ph_dob = patient.ptdob ; >> FROM covr JOIN patient ON covr.pat_no == patient.ptpn >>