or:select (select count(*) from Table1 where T1Name <= a.T1Name) as T1No,a.T1Name from Table1 a
果你的表没有其它任何字段,一句不行.如果有跳号ID字段就可以, select (select count(*) from 表 where ID<=aa.ID) as tlno,tlname from 表 aa
select identity(int,1,1) as T1No ,TlName into #a from Table go select * from #a
select identity(int,1,1) as T1No,T1Name into #temp from tableName select * from #temp drop table #temp
如果该表有一个关键字段a那么可以这样 select (select count(1) from tableName where a <= a.a) as T1No,a.T1Name from tableName aor select (select sum(1) from tableName where a <= a.a) as T1No,a.T1Name from tableName a
from Table1 a
select (select count(*) from 表 where ID<=aa.ID) as tlno,tlname from 表 aa
from Table
go
select * from #a
select * from #temp
drop table #temp
select (select count(1) from tableName where a <= a.a) as T1No,a.T1Name
from tableName aor select (select sum(1) from tableName where a <= a.a) as T1No,a.T1Name
from tableName a
这里有老龟奴zyq_123雍亲正当大版主,还有人称辣花摧魔前青楼名妓smoke当镇小版主,肯定能满足您的需要!!!快来吧~~~~~~