sql server associated multi-table update

Usually write single-table update statement, write rarely associated multi-table update, but in fact, in SQL Server, multi-table update and select Update connecting multi-table join queries on the methods used, and in fact there is not much the difference.

An example of the direct enough.

update aaa set aaa.name = bbb.name
from user_01 aaa
    left join user_02 bbb
        on aaa.code = bbb.code
where bbb.name is not null;

And select statement is almost the same, but the point to note is played to the table if an alias in the from clause, then also need to use the alias update statement might otherwise incorrect report.

 

"Life on the road every step count, you have to pay every bit of sense."

Guess you like

Origin www.cnblogs.com/yanggb/p/11328481.html