MySQL Forums
Forum List  »  InnoDB

Re: Update a row or insert if don´t exist
Posted by: Arjen Lentz
Date: June 16, 2005 07:44PM

Andrew Gilfrin wrote:
> Yep your right of course, I did find it in the docs after I posted.
> However you said
> "The update is actually completely independent from the insert, so in theory you could even do
> something in another table."
> Thats doesn't seem to be the case. It trys the insert and if if fails it does the update using
> the key from the insert.

That may depend on whether the UPDATE part has a WHERE clause or not, and actually accesses the same table as the insert (which it does not have to). I don't remember the exact logic - if it's not in the doc, do try stuff and send report to in the Docs category - then it can be added.

Regards, Arjen.
Arjen Lentz, Exec.Director @ Open Query (
Remote expertise & maintenance for MySQL/MariaDB server environments.

Follow us at &

Options: ReplyQuote

Written By
Re: Update a row or insert if don´t exist
June 16, 2005 07:44PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.