From: Martijn Tonies Date: April 13 2007 10:09am Subject: Re: Is it possible to either update or insert in a single query? List-Archive: http://lists.mysql.com/mysql/206128 Message-Id: <013b01c77db3$c55ad1f0$9902a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit > REPLACE is a MySQL extension to the SQL standard. It either inserts, or > deletes and inserts. For another MySQL extension to standard SQL — that > either inserts or updates — see Section 13.2.4.3, “INSERT ... ON DUPLICATE > KEY UPDATE Syntax”. Take note!! If you're using triggers, foreign key constraints or defaults on columns, it is better to use ON DUPLICATE cause it will update instead of deleting the row first. Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com