Don, Thank you very much.
The only problem is that the primary index Code, Model and Year and what I need is to duplicate the Code, Model and Units for a different year, 2003, that does not exist. If I do the statement bellow it won't work. What I need is to insert Code, Model, Units for a specific code match but they have to be duplicated for year 2003. Thanks again, C.F. ----- Original Message ----- From: "Don Vu" <[EMAIL PROTECTED]> To: "Carlos Fernando Scheidecker Antunes" <[EMAIL PROTECTED]>; "MySQL List" <[EMAIL PROTECTED]> Sent: Tuesday, June 18, 2002 9:38 AM Subject: RE: How to duplicate records > mabye an insert into...select will work, something like: > > INSERT INTO <new tablename> > SELECT Code, Model, Units > from <original table> > where Year=2003 > and ((Code = 'N200') or (Code='N205')); > > http://www.mysql.com/doc/I/N/INSERT_SELECT.html > > -Don > > -----Original Message----- > From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 18, 2002 10:25 AM > To: MySQL List > Subject: How to duplicate records > Importance: High > > > Hello all, > > I've got some records of a Database that I would like to duplicate if > possible with an statement. > > The table has Code, Model, Year, units. The primary key is Code, Model and > Year. What I need is to duplicate Code, Model and units for a different > year. > > Say I want to duplicate all records which Code are N200 and N205 with the > same model and same units but for year 2003. > > Is there any select and insert/replace statement to acomplish this? > > There are about 3.000 records and doing that manually is impossible. I am > considering dump the whole file to a .csv and change year to 2003 and then > reinsert it. > > Is there any way to do it in a smart way? Meaning an SQL statement. > > Thank you, > > Carlos Fernando. > > > --------------------------------------------------------------------- > 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 > > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- 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