Nezir Zahirović

MSSQL : Update a column in one table with values from some other table

In this post I will show you one useful MS T-SQL Query.
It's about updating a one column from one tables with values from some other table.

The query :



UPDATE t1
SET t1.column1= t2.column2 FROM dbo.someTable1 t1 INNER JOIN
dbo.someTable2 t2 ON t1.joinColumn =t2.joinColumn

We do simple update a column in table someTable1 alias t1 with values from someTable2, we do inner join on join column in this sample that is a joinColumn .

That' all folk's for this time ;) Goodbye ...

SHARE
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment