Problem re. ordering selection

From: Malcolm Parnell <parnell_at_auslig.gov.au>
Date: 18 May 1994 15:31:14 +1000
Message-ID: <2rc972$hca_at_bigmig.auslig.gov.au>


There exists a table X with columns and data thus :

name num
---- ---

a     2
b     10
c     4
d     7
e     1
f     9
g     7

I want to know what ranking "f" get if the table is ordered by num, name ie.

e     1    --> rank 1
a     2    --> rank 2
c     4    --> rank 3
d     7    --> rank 4
g     7    --> rank 5
f     9    --> rank 6
b     10    --> rank 7

How can I do this in a SQL statement?

I've tried :

	select rownum,name,num
	from x
	order by num,name

but the rownum is assigned BEFORE the order is performed.

I can't use an order by clause when inserting into another table ... and I can't figure how I can use a sequence.

Thanks in advance

ORACLE RDBMS V6.0.30.3.1 under Ultrix 4.3

Malcolm Parnell
GIS DBA
parnell_at_auslig.gov.au Received on Wed May 18 1994 - 07:31:14 CEST

Original text of this message