Hi,
suppose I've got a table "RichMan" with columns
ID, Name, Bucks
1, 'John', 300
2, 'Joe', 700
3, 'Al', 400
4, 'Fred', 250
5, 'Jim', 480
and I sort them with respect to "Bucks". Then John would be on the first
place because he ist the richest, followed by 'Jim', etc.
Now I'm looking for an SQL-Statement "select blablabla from RichMan
blablabla ID"
which returns me the rank of the ID if sorted by Bucks.
So:
"select blablabla from RichMan blablabla 1" would return 4 because John
with the ID 1 is the 4th-richest.
"select blablabla from RichMan blablabla 3" would return 2 because Al with
the ID 3 is the 3rd-richest.
And so on.
It would also be interesting to do it the other way round: give the rank
and get the ID
Thanks in advance
Horst