Hi Rob,
i think to use REPLACE would do, if there is a unique index on myid:
REPACE mytable (myid, myname) VALUES (myid, mynewname);
The Manual say in chapter 6.4.8:
REPLACE works exactly like INSERT, except that if an old record in the table
has the same value as a new record on a UNIQUE index
See the REPLACE command: http://www.mysql.com/doc/en/REPLACE.html
---
I am trying to update/insert a record into the table depending on whether
it
exists in the table or not.
Something along the lines of...
IF (SELECT id
I am trying to update/insert a record into the table depending on whether it
exists in the table or not.
Something along the lines of...
IF (SELECT id FROM myable WHERE id="myid")
INSERT INTO mytable(id,name) VALUES ("myid", "myname")
ELSE
UPDATE mytable SET name="mynewname" WHERE