Re: Useful SQL-statement?

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: -anssi <anssiman(at)jippii(dot)fi>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Useful SQL-statement?
Date: 2003-09-24 17:23:44
Message-ID: 3F71D320.2000803@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hello!
>
> Is there any standard SQL-statement, which produce
> resultset containing best plyers of the each team?
>
> player |team|points
> -------------------
> paul col 10
> peter col 12
> steve det 12
> sergei det 8
> jere dal 4

Sure:
select distinct on (team) player,team,points
from resultset
order by team asc, points desc

Regards,
Tomasz Myrta

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-09-24 17:24:56 Re: Useful SQL-statement?
Previous Message Richard Huxton 2003-09-24 17:18:37 Re: Especial delimiters caracter