Hi,

I do what to know this literal question. But what about if you are doing
this across two servers? 
You certainly don't want to copy they whole table to the second database to
update the second with the first.
And I know someone will say use replication, but I am more interesting in a
general method outside of that. 

What would be the quickest way to replace by timestamp, records that have
been updated, and delete records on the slave which have been deleted on the
master? 

If you did copy each table to a temp  table on the slave DB you could do it
with just SQL, but that doesn't seem very sensable for a large amount of
data. I can see that you could do that big copy once, then update where
TIMESTAMP <= LASTUPDATE but what about deletes?

I guess all you could do in that case is to do a second DELETE FROM from
table where master index <> slave index

Does that make sense?


Thanks,

Eric 




At 11:34 AM 1/24/01 -0700, Steve Ruby wrote:
>Chuck Barnett wrote:
>> 
>> How do I copy the data from one table to another table with a time stamp
>> every night?
>> 
>> example:  table A contains x,y,z.
>> 
>> at midnight, I want to copy table A's contents to table B (B has same
>> fields, just adds a date field) and reset x,y,z to zero.
>> 
>
>
>what do you mean by "reset to zero"  If you want to copy the files
>from A to B you can just do
>
>insert into B select x,y,z,now() from A;
>delete form a;
>
>if your date field in B is a TIMESTAMP type you can avoid the now()
>part and do
>
>inesrt into B (x,y,z) select x,y,z from A;
>delete from a;
>
>See the manual about the insert statement for more info.
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


Frazier Consulting
http://www.kwinternet.com/eric
(250) 655 - 9513




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to