Thanks for replying. I know the SQL commands, I want to know how to automate the whole sequence. I've always written php pages that do the calls. I want to write a script to do it on the server as a cron job or something. thanks Chuck ----- Original Message ----- From: "Steve Ruby" <[EMAIL PROTECTED]> To: "Chuck Barnett" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, January 24, 2001 12:34 PM Subject: Re: automation question: How do I copy the data from one table to another table with a time stamp every night? > 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