http://blog.163.com/neso520@126/blog/static/16275753620104272349605/
select Identity(int,1,1) as rowIndex,Title,hits into #tmp
from(Select TOP 100 Percent * from _Table order by hits desc) b
select * from #tmp
drop table #tmp
----------------------------------------
解释:#tmp是个虚拟表,不用改这个表的名字。
Select TOP 100 Percent * from _Table order by hits desc
上面这一句是你要添加行号的select语句。
Title,hits必须包含在上面这条select语句的结果中。
“b”一定不可以去掉。