读书人

这句话那么长,小弟我如何改它的别名呢

发布时间: 2012-02-04 15:43:09 作者: rapoo

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

读书人网 >SQL Server

热点推荐