I have a table table1
with three columns and a bunch of rows:
[key_col|col_a|col_b]
I want to update col_a with a set of values (i.e. leaving col_b
unchanged), something like this:
INSERT INTO table1 AS t1 (key_col, col_a) VALUES ("k1", "foo"), ("k2", "bar");
But it doesn't work, how do I do this?
You have to use UPDATE instead of INSERT:
For Example:
UPDATE table1 SET col_a='k1', col_b='foo' WHERE key_col='1';
UPDATE table1 SET col_a='k2', col_b='bar' WHERE key_col='2';