AW: IF, THEN ELSE statement

2003-09-10 Thread Franz, Fa. PostDirekt MA
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

Re: IF, THEN ELSE statement

2003-09-10 Thread Alec . Cawley
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

IF, THEN ELSE statement

2003-09-10 Thread Rob Anderson
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