Jump to content

Compare tables


CyJobes

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.