I have two tables:
CREATE TABLE Table1 (
ID VARCHAR(15),
Value INT
);
INSERT INTO Table1 (`ID`, `Value`)
VALUES
('A', 21),
('B', 50),
('C', 10);
CREATE TABLE Table2 (
ID VARCHAR(15)
);
INSERT INTO Table2 SELECT ID FROM Table1;
I have to rename all the IDs in Table2 whose values in table1 < 20 to “Low_<ID Name>”. After this, “Table2” should look like:
mysql> SELECT ID FROM Table2 +-------+ | ID | +-------+ | A | | B | | Low_C | +-------+
What query will do this?
But as @Phil said…are you sure you want to change your (presumably) primary key
ID?