Just a thought on something I was reading with temp tables: 1. extract the records you want to change the date on from your existing table to a temp table. 2. update the date in the temp table 3. insert the "new" records back into the original table.
This avoids the csv extract and changing then reinserting. R.D. --On Thursday, June 20, 2002 11:32:22 AM -0400 Adam Nelson <[EMAIL PROTECTED]> wrote: > I have looked at this problem before and I honestly think there is not a > proper way to do it within mysql. The only ways are cut & paste, > programmatically, or subselects (slated for 4.1?). > > -----Original Message----- > From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 18, 2002 2:40 PM > To: Don Vu > Cc: MySQL List > Subject: Re: How to duplicate records > > > 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 > > > Richard DeWath System Administrator E.L. and Associates [EMAIL PROTECTED] --------------------------------------------------------------------- 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