I have 2 tables which need to contain the same values. However, there are different queries running on each of them, so basically at some moment, I have to merge them (update any info that is different between the two)
I just need the idea, please say it out if you have any!
Thanks a lot.
Is this something a join could be used with?
Even worst, these 2 tables are on 2 different servers.
MySQL supports some form of replication -- perhaps that could be useful in passing down the information?
When do you have to merge the information -- e.g. immediately as it happens or could you have some sort of lag between them, say every 24 hours?
If so, you could write a script to basically lock the table in the main server and then read the information into the replication server. Unlock the tables and you're good to go.
If you want it to be immediate (and by separate severs you mean separate physical machines and not just different instances / DBs on one box) then I'd write something that (in MySQL):
Upon INSERT, UPDATE, and DELETE statements:
1) Locks all tables on BOTH servers involved
2) Change the info on one server, unlock
3) Change the info on the other server, unlock