This is what I would do:
Take a backup of the database.
Run you above query, extract the results into a CSV file.
Load the CSV file into a spreadsheet.
Workout various UPDATE statements for your different tables, one per row.
Transfer the statements into a text editor, thence run in your SQL browser.