Hi everyone,
I'm fairly new to MySQL and I have a procedure that writes some status
info to a table. The problem is, I just want the values and row to be
replaced, rather than constantly adding a new row. I tried using REPLACE
as well as different timestamp methods, but I always get a new
Hi Dave,
You have no primary key on your table, thus MySQL has no way of knowing
when the row is unique and needs to be updated rather than inserted.
REPLACE INTO effectively does the following:
- insert into table
- did a primary key violation occur?
--- yes - delete existing row from
Ack! Such a simple but important step. No wonder it wasn't replacing the
existing row.
That worked great, thank you very much.
Also, thanks to Brent who replied first. I ended up going with the
primary key over the unique index, but I'm sure that would have worked
as well.
-Dave
Andy