Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Help: Numbering rows returned by a SQL query
Does anyone know how I can number the rows returned
by a SQL statement, for example
SELECT SURNAME
FROM EMP
ORDER BY SURNAME
/
to produce
1 ADAMS
2 BROWN
3 THOMAS
4 YOUNG
I have tried using rownum, but of course the numbers are jumbled
by the alpha sort on the surname!
Any suggestions would be most welcome.
Thanks in advance.
Ted Tate
University of Wales College, Newport
e.j.tate_at_NOSPAM.newport.ac.uk
>>> Remove the NOSPAM. in the address when replying. <<<
Received on Mon Oct 26 1998 - 15:39:44 CST