How to insert to mu开发者_StackOverflowltiple table, how to update one tables from it multiple tables and how to delete it multiple on currently?
The only way to INSERT
to multiple tables is to write multiple INSERT
statements. Same goes for DELETE
. They are single-table operations.
You can UPDATE
one table using several other source tables with a simple JOIN
like so:
UPDATE t1
SET t1.Name = t3.Name
FROM Table1 t1
INNER JOIN Table2 t2
ON t2.ID = t1.ID
INNER JOIN Table3 t3
ON t3.OtherID = t2.OtherID
精彩评论