日期:2014-05-18  浏览次数:20460 次

这句话那么长,我怎么改它的别名呢?
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