Re: select a ranking

Поиск
Список
Период
Сортировка
От Janning Vygen
Тема Re: select a ranking
Дата
Msg-id 200207190954.g6J9snX29715@janning.planwerk6.local
обсуждение исходный текст
Ответ на Re: select a ranking  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: select a ranking  (Bruno Wolff III <bruno@wolff.to>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: csernazs@freemail.hu (Cserna Zsolt)
Дата:
Сообщение: sequence scan, but indexed tables
Следующее
От: "Christian Lübeck"
Дата:
Сообщение: References for PostgreSQL