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

Reply via email to