Skip to content
Advertisement

UPDATE table if data exists in another table

I have two tables. Table A contain this data

Table B contain this data

I’m trying to write a SQL update query that can update data from column_1 in table A into column_1 in table B based on matching value from column_2 in table A and table B

The output should be like this:

I tried many ways but can’t seem to get it right. Can anyone help me how to achieve this? Thanks

Advertisement

Answer

since you are using sqlsrv, i believe this is sql server.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement