selece IDENTITY(int, 1,1) AS bh,  La,Lb,Lc into #temp form mytable order by La
select * from #temp
drop table #temp

解决方案 »

  1.   

    select (select count(*) from mytable  where la<=a.la) id,La,Lb,Lc 
    form mytable a order by La
      

  2.   

    select identity(int,1,1) id,La,Lb,Lc into # from mytable order by Laselect * from #drop table #
      

  3.   

    selece (select sum(1) from mytable  where la<=a.la) as id,La,Lb,Lc 
    form mytable a order by La
      

  4.   

    select identity(int,1,1) id,La,Lb,Lc into # from mytable order by Laselect * from #drop table #
      

  5.   

    selece IDENTITY(int, 1,1) AS bh,  La,Lb,Lc into #temp form mytable order by La
    select * from #temp
    drop table #temp假如la中的记录值不重复的话,可以用:selece (select sum(1) from mytable  where la<=a.la) as id,La,Lb,Lc 
    form mytable a order by La