Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sequence # next to an ordered column

Re: sequence # next to an ordered column

From: Andy Hardy <Andrew.Hardy_at_BGTechnology.com>
Date: Tue, 26 Sep 2000 14:39:58 +0100
Message-ID: <8qq8th$bp2$1@sun-cc204.lboro.ac.uk>

Why not just use

    SELECT ename, rownum
    FROM emp
    ORDER BY ename;

Andy

--

Opinions are mine and may not reflect those of BG Technology Ltd   Swaminathan. N <hi_at_indya.com> wrote in message news:39D07C2A.9683FEA1_at_indya.com...
  can i use this query ???
  select ename, rownum from
   (select ename from emp order by ename);     

  "Swaminathan. N" wrote:

    How to get a column in the table ordered and sequence # next to that.

    For e.g. assume that there is a emp table. the following is the query

      select ename from emp order by ename; 
      
=========================
 

      Assume that the this is the data: 
     ENAME 
     ---------- 
     ADAMS 
     ALLEN 
     BLAKE 
     CLARK 
     FORD 
     JAMES 
     JONES 
     KING 
     MARTIN 
     MILLER 
     SCOTT 
     SMITH 
     TURNER 
     WARD 

    I want next to the result the sequence no.     That is the result should be as follows:

      ENAME          ROWNUM 
     ---------- ---------- 
     ADAMS               1 
     ALLEN               2 
     BLAKE               3 
     CLARK               4 
     FORD                5 
     JAMES               6 
     JONES               7 
     KING                8 
     MARTIN              9 
     MILLER             10 
     SCOTT              11 
     SMITH              12 
     TURNER             13 
     WARD               14 

    regards,
    swami

--
Received on Tue Sep 26 2000 - 08:39:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US