declare @t table([name] varchar(10)) insert into @t select 'aa' insert into @t select 'bb' insert into @t select 'cc' insert into @t select 'dd' insert into @t select 'teqeq'select [id]=identity(int,1,1),* into # from @t select [name] from # where id=5 drop table #select [name] from (select *,id=(select count(1) from @t where [name]<=a.[name]) from @t a)b where b.id=5
select [name] from (select *,id=(select count(1) from @t where [name]<=a.[name]) from @t a)b where b.id=5 这个写错了
insert into @t select 'aa'
insert into @t select 'bb'
insert into @t select 'cc'
insert into @t select 'dd'
insert into @t select 'teqeq'select [id]=identity(int,1,1),* into # from @t
select [name] from # where id=5
drop table #select [name] from (select *,id=(select count(1) from @t where [name]<=a.[name]) from @t a)b where b.id=5
这个写错了