Re: select a ranking

From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: select a ranking
Date: 2002-07-19 09:54:48
Message-ID: 200207190954.g6J9snX29715@janning.planwerk6.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Freitag, 19. Juli 2002 02:41 schrieb Martijn van Oosterhout:
> On Thu, Jul 18, 2002 at 03:29:10PM +0200, Janning Vygen wrote:
>
> > i do some ordering on a table and need a ranking by points from a
> > table with names and points
>
> > is there an easier way to create a ranking?
>
> Yep, in the presentation tool. Pseudo-code is:
>
> For each row in result
> print rownumber
> print contents of row

this wont work because the ranking is not equal to the rownumber.
there are very often two second places. and there might be a
complicated logic to the ordering. there might be many columns
affected to to the ordering in sql.

the presentation tool can just number the rows, but it cant decide
easily if there are two second places. in sport rankings you have
often more than five ordering parameters and you still can have two
second places. So the presentation tool needs to know this ordering
logic to decide how to do the ranking. if there are changes in
ranking/ordering logic, i need to update all my presentation
clients...

> Why do you want to do this in SQL when it's clearly not the right
> place for it?

but you do the ordering in sql anyway. it would be just fine to add a
column with the ranking.

kind regards,
janning

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jakub Ouhrabka 2002-07-19 10:00:08 Regular expression validation
Previous Message Siva Kumar 2002-07-19 09:52:48 Re: Too many clients to Postgresql server