update #temp set pm=b.pm from #temp a,(select distinct cj,(select count(*)+1 from #temp where cj> a.cj ) as pm from #temp a ) b where a.cj=b.cj
如果我在用这句话时,由于觉得pm太长,我想用p代替,怎么写呢
------解决方案--------------------
update #temp set pm=b.p from #temp a,(select distinct cj,(select count(*)+1 from #temp where cj> a.cj ) as p from #temp a ) b where a.cj=b.cj