I have a column, person_id
, in several tables in my database. I'm getting rid of duplicates in my individuals table
and need to update the person_id
in the rest of the tables.
My schema is clud
and my tables are:
address
cases
child_cases
matter_person
phone
individuals
How can I update all the tables at once instead of doing them individually?
Individuals table
person_id | first_name | last_name
----------------------------------
100 John Doe
101 John Doe (duplicate value)
I want to delete the record where person_id is 101 and I need to change the person_id in all other tables to 100 where the person_id is 101.
Cases Table
person_id | case_number
-----------------------
100 12345
101 6789
Result
person_id | case_number
-----------------------
100 12345
100 6789
matter_person Table
person_id | matter_number
-------------------------
100 123abc
101 456def
Result
person_id | matter_number
-------------------------
100 123abc
100 456def