Actually if you are using 4.1.x INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=3;
One of the best new features, because insert is faster than an update, update is faster than a delete, and replace is the slowest command you can run. These are based on my benchmarks about 6 months ago. This is definitely one of my favorite commands now. Donny > -----Original Message----- > From: B. Fongo [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 7:23 AM > To: 'Andy Ford'; [EMAIL PROTECTED] Mysql. Com > Subject: RE: update if insert fails > > Use REPLACE instead. It is similar to the INSERT except that, it will > replace any old record that match - with the new one. A replace > statement may look like this: > > REPLACE INTO TestTable (TestId, User) VALUES ("007","Bond"); > > HTH > > Babs > > > > ||> -----Original Message----- > ||> From: Andy Ford [mailto:[EMAIL PROTECTED] > ||> Sent: Friday, April 23, 2004 1:59 PM > ||> To: [EMAIL PROTECTED] > ||> Subject: update if insert fails > ||> > ||> Hi > ||> > ||> Is there such a statement where, if the insert fails (due to a > duplicate > ||> record) an update will happen > ||> > ||> Thanks > ||> > ||> Andy > ||> > ||> > ||> -- > ||> 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] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]