有一个字段 shuzi
create table #test(id int ,shuzi char(5))
insert into #test
select '1','7' union all
insert into #test
select '2','8' union all
insert into #test
select '3','9' 
seletc * from #test 
返回的结果
1 7
2 8
3 9我现在想把表中的该列记录倒叙,实际物理位置的倒叙 不是输出倒叙
就是说在seletc * from #test 
返回的结果
1 9
2 8
3 7应该怎么改变呢?我只是举这个例子,表中不是只要3个记录o(∩_∩)o... 有很多记录
o(∩_∩)o...

解决方案 »

  1.   

    仅仅是把shuzi 这一列倒过来吗?
    还是要排序?
      

  2.   


    --这样?
    create table #test(id int ,shuzi char(5)) 
    insert into #test select '1','7'
    union all select '2','8' 
    union all select '3','9' 
    union all select '4','10' 
    union all select '5','11'
    union all select '6','12'select px=identity(int,1,1),* into # from #test order by id desc
     
    update #test set shuzi=b.shuzi from #test a,# b
    where a.id=b.px
    select * from #test