Ranking? - Mailing list pgsql-novice

From Sjors
Subject Ranking?
Date
Msg-id 000801c3837c$100ff350$04a779d9@cc299057a
Whole thread Raw
Responses Re: Ranking?
List pgsql-novice
Hi list,
 
Wondering if you could help me out here? I've got a table like this:
 
id    name    data
1    sully        567
2    sully        789
3    sully        456
4    denan       890
5    denan        678
 
now I want to have this:
 
id    name    data    rank
1    sully        567    2
2    sully        789    1
3    sully        456    3
4    denan       890    1
5    denan        678    2
 
I'm think along the lines with count, something like this:
 
select id,name,data, (select count (names) from table as tmp where data.tmp > data.table) as rank
 
this (I know) is not correct. What would be?
 
Greetings sjors
 

pgsql-novice by date:

Previous
From: Jonathan Telep
Date:
Subject: Backing Up a Postgres database...
Next
From: Owen Funkhouser
Date:
Subject: Difficult select statement