Carlos, Tuesday, June 18, 2002, 5:24:48 PM, you wrote: CFSA> I've got some records of a Database that I would like to duplicate if CFSA> possible with an statement.
CFSA> The table has Code, Model, Year, units. The primary key is Code, Model and CFSA> Year. What I need is to duplicate Code, Model and units for a different CFSA> year. CFSA> Say I want to duplicate all records which Code are N200 and N205 with the CFSA> same model and same units but for year 2003. CFSA> Is there any select and insert/replace statement to acomplish this? CFSA> There are about 3.000 records and doing that manually is impossible. I am CFSA> considering dump the whole file to a .csv and change year to 2003 and then CFSA> reinsert it. CFSA> Is there any way to do it in a smart way? Meaning an SQL statement. You can't do it with one SQL statement. MySQL has INSERT .. SELECT and REPLACe .. SELECT statements but you can't retrieve data from the same table into which you are inserting. What about inserting necessary data into temporary table and than upload them into your table? You can find info about INSERT .. SELECT and REPLACE .. SELECT at: http://www.mysql.com/doc/I/N/INSERT_SELECT.html http://www.mysql.com/doc/R/E/REPLACE.html CFSA> Thank you, CFSA> Carlos Fernando. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- 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