Question is how to update string field by concatenating to it?
Here is code for creating database and adding one row:
CREATE DATABASE my_db;
USE my_db;
CREATE TABLE IF NOT EXISTS my_table(
article_id INTEGER unsigned,
revision_ids VARCHAR(10),
PRIMARY KEY (article_id)
);
INSERT INTO my_table (article_id, revision_ids) VALUES (1, "154");
I need to write code which concatenate string to revision_ids field. For example, I need to concatenate ", 999" to "154", so I will get "154, 999". My version of code does not work:
UPDATE my_table SET revision_ids = CONCAT((SELECT revision_ids FROM my_table WHERE article_id = 1), ", ", "999") WHERE article_id = 1;
How to do it?
There is one important condition. Theoretically this concatenation could do several scripts, so it is important that while our updating nobody can change the field value.