Using cross apply in update statement

柔情痞子 提交于 2019-12-04 02:44:58

问题


Is it possible to use the cross apply clause in the from part of an update statement, in SQL Server 2005?


回答1:


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 ...


来源:https://stackoverflow.com/questions/7492797/using-cross-apply-in-update-statement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!