34,590
社区成员
发帖
与我相关
我的任务
分享
select rn = identity(int,0,1), id, dw into #temp from css where xm='100' and zt = 'no' order by dw
update css set zt = 'yes' where xm='100' and zt = 'no'
select idd=id, zbh=rn/5+1, dww=dw from #temp
;with cte as
(
select rn=row_number()over(order by dw)-1, id, dw from css where xm='100' and zt='no'
)
select idd=id, zbh=rn/5+1, dww=dw from cte
;with cte as
(
select rn = row_number() over(order by getdate()) - 1, id,dw from css where xm='100' and zt='no'
)
select idd=id,zbh=rn/5+1, dww=dw from cte