当前位置:Gxlcms > 数据库问题 > SQL Update TOP 、Update Order by 和output的使用

SQL Update TOP 、Update Order by 和output的使用

时间:2021-07-01 10:21:17 帮助过:10人阅读

update top(1) Products with(updlock,readpast)
set Status = 1
output Deleted.Id as PoolSkuId
from 
(select top 1 Id from Products 
where Deleted = 0 and Status = 0 order by createdTime desc) t1
where Products.Id = t1.Id

  

SQL Update TOP 、Update Order by 和output的使用

标签:products   pool   desc   with   lock   put   let   create   使用   

人气教程排行