Re: Ranking?
От | Sjors |
---|---|
Тема | Re: Ranking? |
Дата | |
Msg-id | 001101c383bd$f11ad130$04a779d9@cc299057a обсуждение исходный текст |
Ответ на | Ranking? ("Sjors" <jkwast@freeler.nl>) |
Список | pgsql-novice |
Hi Manfred, Sometimes the solution is right in front of you, but the cloud is to thick. Thanks a lot, it worked like a charm. The reason I want this, is to have a new type of index, so speed is not a issue and data file not big (just about 15000 records). I know, it's sounds silly. Greetings Sjors > >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 > > SELECT id, name, data, (SELECT count(*) + 1 > FROM tbl AS tmp > WHERE tmp.name = tbl.name > AND tmp.data > tbl.data) AS rank > FROM tbl; > > should get you going but might perform horribly without an index on > name ... > > Servus > Manfred >
В списке pgsql-novice по дате отправления: