开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜