Jump to content

Recommended Posts

I have two tables that are identical in fields.

rate_info_stndby - used to edit site in an admin before going live

rate_info - live table used on site

 

I need a fast and easy way to compare the tables and find out what is different between the two.

 

This way I can create a list of inserts, updates or deletes.

 

Once table are in sync they are, of course, identical in data. However, the rate_info_stndby table is accessed only by the admin and can change in data entry, new rows or deleted rows. Finding these differences is what I need to alert the admin that the tables are no longer in sync, and to use the info to create the SYNC script.

 

I've worked with MySQL for a while, but not very deep. I just finished a "MySQL for Developers" course, but joins went way over my head.  ;D

 

Any help would be appreciated.

 

Thanks,

Cy

Link to comment
https://forums.phpfreaks.com/topic/150771-compare-tables/
Share on other sites

Found this code snippet off the mysql website:

 

mysqldump -l -B db1 > db1.sql
mysqldump -l -B db2 > db2.sql
diff db1.sql db2.sql > diff.sql

 

Of course you can add tables in for your cause.  Link, http://lists.mysql.com/mysql/190020.

 

Hope this helps  ;)

 

 

Link to comment
https://forums.phpfreaks.com/topic/150771-compare-tables/#findComment-792128
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.