22,209
社区成员
发帖
与我相关
我的任务
分享
Update a set a.state=4 from gds_Products a
where state =0 and infotype =1
and exists (select * from (select substring(prowbs,1,len(prowbs)-5) as prowbs,prono
,max(EffectiveTime) as EffectiveTime
from gds_Products where state =0 and infotype =1
group by prono,substring(prowbs,1,len(prowbs)-5)) b
where substring(a.prowbs,1,len(a.prowbs)-5) = b.prowbs
and a.prono =b.prono
and a.EffectiveTime != b.EffectiveTime)
Update a set a.state=4 from gds_Products a
where state =0 and infotype =1 and exists
(select * from (select substring(prowbs,1,len(prowbs)-5) as prowbs,prono,max(EffectiveTime) as EffectiveTime from gds_Products where state =0 and infotype =1 --and EffectiveTime<=Getdate()
group by prono,substring(prowbs,1,len(prowbs)-5)) b where substring(a.prowbs,1,len(a.prowbs)-5) = b.prowbs and a.prono =b.prono
and a.EffectiveTime != b.EffectiveTime)