UserYmY
UserYmY

Reputation: 8574

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

My question: How to assign the value as 'USA' to address column where the value in name columns are equal in both the tables.

Upvotes: 0

Views: 1069

Answers (1)

Prashant16
Prashant16

Reputation: 1526

UPDATE data2 SET
Address = 'USA'
WHERE Name IN (SELECT Name FROM data1)

Upvotes: 1

Related Questions