[英]How to replace values of a column in MySQL table with another value
I have a table named as data1 with two columns (Name, address)
and an another table named as data2 with same columns 我有一个名为data1的表,其中有两列
(Name, address)
而另一个表名为data2,具有相同的列
My question: How to assign the value as 'USA' to address
column where the value in name
columns are equal in both the tables. 我的问题:如何将值“ USA”分配给两个表中
name
列中的值相等的address
列。
UPDATE data2 SET
Address = 'USA'
WHERE Name IN (SELECT Name FROM data1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.