Hi all,

Thanks for the help.

So I can "Insert into archive_table select * from active_table where
condition='true'", followed by a delete from active_table...

If my archive_tabler is nearly exactly the same but has two more fields
(housekeep_id, and now()), how do I modify the above statement to move the
record to archive_table and add in two more fields?

-----Original Message-----
From: darren [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 07, 2004 11:44 PM
To: [EMAIL PROTECTED]
Subject: moving records between tables?

Hi all,

I have 2 tables...one for keeping active items while the other is for older
records.

A housekeep program will come in every night to move some records (matching
several criteria from the active table to the history one.

I am currently doing SELECT, INSERT and then DELETE. i.e. a "select * from
active where key=key_value limit 1" and then a "insert into history..." and
then a "delete * from active where pri_key='pri_key_value'..."

I am sure there's a better way right??


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to