Hello,

I recently stumbled upon the INSERT INTO..SELECT abilities. Basically
what I'm doing is archiving records into another table before deleting
them (inventory information). However, I'd like to have the archive
table to have one more field than the original table: a date_archived
function. So, for example if the tables looked like this: (quite
simplified)

Original:

carton_id
item_id
qty
status
date_recd

Archive

carton_id
item_id
qty
status
date_recd
date_archived *(new field)

Can I have the SQL query have a NOW() in there to insert today's date
when running this ? 

"INSERT INTO archive
(carton_id,item_id,qty,status,date_recd,date_archived) 
SELECT carton_id,item_id,qty,status,date_recd, NOW() FROM original"

Would this work? I'd like to know upfront before basing my code around
this or whether or not I'll have to track how many records are going
into the new table and manually updating the field. Thanks.

- Greg




---------------------------------------------------------------------
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