From: Date: December 28 2005 3:57pm Subject: update or insert if necessary? List-Archive: http://lists.mysql.com/mysql/193279 Message-Id: <000601c60bbf$058a5a10$6401a8c0@mainmach> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0003_01C60B84.587BE120" ------=_NextPart_000_0003_01C60B84.587BE120 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a situation where I need to update a record for a given key in a = MySQL table, but insert a record if the key doesn't exist. I could do = this by doing a SELECT on the key, then doing an UPDATE if anything = comes back, or and INSERT otherwise. This seems rather clunky though, = and I'm wondering if there is anything like and "up-sert" command, or at = least a preferred way of doing this operation. TIA....Steve ------=_NextPart_000_0003_01C60B84.587BE120--