Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: sequence # next to an ordered column
On Tue, 26 Sep 2000 16:06:26 +0530, "Swaminathan. N" <hi_at_indya.com> wrote:
Try it:
select rownum,ename from
(select ename from emp group by ename)
/
My db is Oracle 8.0.4
Violin.
violin.hsiao_at_mail.pouchen.com.tw
>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 Wed Sep 27 2000 - 00:51:01 CDT
![]() |
![]() |