Hi,
I have a table with a column readStatus, if the readStatus is true (it has been read), I can update the table for other columns values, otherwise, I need to insert a new row. Obviously, the following command does not work, is there any way I can have a match statement readStatus = true for doing update?
INSERT INTO table (id, timestamp, readStatus) VALUES (id_value, timestamp_value, false) ON DUPLICATE KEY readStatus = true UPDATE id = id_value, timestamp = timestamp_value;
Thank you.
I have a table with a column readStatus, if the readStatus is true (it has been read), I can update the table for other columns values, otherwise, I need to insert a new row. Obviously, the following command does not work, is there any way I can have a match statement readStatus = true for doing update?
INSERT INTO table (id, timestamp, readStatus) VALUES (id_value, timestamp_value, false) ON DUPLICATE KEY readStatus = true UPDATE id = id_value, timestamp = timestamp_value;
Thank you.