select col from table_name order by col desc
请问如何能改善上面这个SQL语句增加一列取出序号。如按1、2、3 . . . 这样排列出来?

解决方案 »

  1.   

    select rownum, col from
      (select col from table_name order by col desc);
      

  2.   

    select rownum,col from table_name order by col desc
    即可以啊
      

  3.   

    楼上的这着是不行的   虽然是给查出的记录上赋了12
    但是他的显示是乱的  若要用ROWNUM来显现这个功能必须用嵌套语句来实现
      

  4.   

    对,楼上的说的对。必须要先排序。
    select rownum, col from
      (select col from table_name order by col desc);