At the beginning, I used the following method for searching online:
Update tbl1
Set (a. col1, a. col2) = (select B. col1, B. col2
From tbl2 B
Where a. key = B. key)
Then, after using it, I am miserable. After the operations I did directly on the server, I could not log on to the system. It was later found that the value of a field was empty because the statement was updated, and the view was used during login. This field is used when the view connects to the table. Many users failed to log on, which is really miserable!
Later, Baidu realized that this was the reason. If the tbl1.key value does not have this value in tbl2.key, the updated fields tbl1.col1 and tbl1.col2 will be updated to null ).
Speed draws on the writing of great gods:
Update tbl1
Set (a. col1, a. col2) = (select B. col1, B. col2
From tbl2 B
Where a. key = B. key)
Where a. key in (select key from tbl2) // This sentence is quite critical.
Special thanks to http://www.codesky.net/article/201004/167714.html!
Record this question for your reference and use.