在更新语句中使用交叉应用 [英] Using cross apply in update statement
本文介绍了在更新语句中使用交叉应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SQL Server 2005中,是否可以在更新语句的from部分中使用cross apply子句?
Is it possible to use the cross apply clause in the from part of an update statement, in SQL Server 2005?
推荐答案
您说得对,阿尔伯特.我进行了一些测试,发现确实可以.用法与SELECT
语句中的用法相同.例如:
You where right, Albert. I made some tests and found that it's possible, indeed. The use is the same as in a SELECT
statement. For example:
UPDATE some_table
SET some_row = A.another_row,
some_row2 = A.another_row/2
FROM some_table st
CROSS APPLY
(SELECT TOP 1 another_row FROM another_table at WHERE at.shared_id=st.shared_id) AS A
WHERE ...
这篇关于在更新语句中使用交叉应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文