开发者

MySQL: inserting data into a subset of rows within a table

开发者 https://www.devze.com 2023-03-29 22:48 出处:网络
Basically, I\'d like to do something like the following. i开发者_StackOverflow.e. place all strings \"USA\" with \"US.\"

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

精彩评论

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

关注公众号