I have data in two tables. City and Address.
City
id - name - code
1 - abc - 1
2 - xyz - 2
3 - efg - 2
Address
id - city_id - name
1 - 1 - wer
2 - 2 - sdf
3 - 3 - tyu
Now code for cities with id 2 and 3 are the same. I want to delete the city with id 3 and change city_id 3 to 2 in the Address table so that the last two rows of Address table are associated with city id 2
In other words, I want to delete duplicate rows in the parent table and update the child table accordingly. There are thousands of such rows in my 2 tables.