您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

通过加入从CTE中删除

通过加入从CTE中删除

您可以在CTE中使用exists()而不是内部MyTable联接。

with cte as 
(
  select top(1) q.id,
                q.col1
  from queue q with (readpast)
  where exists(
              select *
              from  MyTable a 
              where  q.id = a.myTableID AND 
                     a.procID = @myParam
              )
  order by q.Data asc
)
delete from cte
output deleted.ID, deleted.col1;
其他 2022/1/1 18:28:44 有503人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶