MySQL Forums
Forum List  »  PHP

Compare Two Tables and Insert Missing Foreign Keys
Posted by: Paul Maher
Date: April 17, 2021 08:28PM

what's the correct way to compare two tables and update table 2 with missing any IDs?

Scenario:

Table 1 with primary key 'id'

Table 2 with foreign key, 'related_id

Compare the two tables and insert any missing IDs into table 2 'foreign_key' column

Options: ReplyQuote


Subject
Written By
Posted
Compare Two Tables and Insert Missing Foreign Keys
April 17, 2021 08:28PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.