MySQL: inserting data into a subset of rows within a table
Basically, I'd like to do something like the following. i开发者_StackOverflow.e. place all strings "USA" with "US."
insert into table (column1) values ('US') WHERE << column1 = 'USA' >>
What is the correct query to perform the the above? This is within the same table.
Do you mean?
update table set column1 = 'US' where column1 = 'USA';
INSERT INTO my_table (column1) VALUES ('US') WHERE id IN (SELECT column1 FROM my_table WHERE column1 = 'USA')
Mind you this query makes no sense whatsoever.
精彩评论