日期:2014-05-18 浏览次数:20502 次
;With cte_update As ( /*n 控制要更新的行数*/ Select Top (n) * From OP_AD_Statistics Where StaADSource='xxxx' Order by StaID ) update cte_update Set StaADSource = 'xxxx' , StaClickNum = 2
------解决方案--------------------
Update OP_AD_Statistics a Set StaADSource='xxxx', StaClickNum= 2 Where dt= (Select max(dt) from OP_AD_Statistics Where StaADSource='xxxx' and a.StaID =StaID )
你要按什么来算最后一条。这个表的最后一条?以上是StaID 相同,dt最大的