In SQL how do you update each row of the table by finding all rows that are equal for a column, then set another column equal to eachother

In SQL Server you can do something like:

UPDATE Table_1
SET Column_2 = t2.Column_2
FROM Table_1 AS t1
INNER JOIN Table_2 AS t2 ON t2.Column_1 = t1.Column_1

or something like

UPDATE Table_1
SET Column_2 = ( 
    SELECT t2.Column_2
    FROM Table_2 AS t2
    WHERE t2.Column_1 = Table_1.Column_1
)

Of course if you have multiple rows in Table_2, you will get an error....


The basics of it is:

UPDATE Table1 SET col2 =
     (select col2 FROM Table2 where Table2.column2 = Table1.column1)

But that may not do exactly what you need if there's not a 1-1 correspondence between rows in the two tables - and hence my current comment below your question:

What should happen if there are more than one matching row in table 2? What should happen if there's no matching row?