Tuesday, 26 September 2017

MSSQL : Update a column in one table with values from some other table ~ gniithelp ~ programming info

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 ;)

No comments:

Post a Comment