Re: olympics ranking query - Mailing list pgsql-sql

From Tom Lane
Subject Re: olympics ranking query
Date
Msg-id 22979.1093020382@sss.pgh.pa.us
Whole thread Raw
In response to olympics ranking query  (David Garamond <lists@zara.6.isreserved.com>)
Responses Re: olympics ranking query  (David Garamond <lists@zara.6.isreserved.com>)
List pgsql-sql
David Garamond <lists@zara.6.isreserved.com> writes:
> Challenge question: is there a simpler way to do query #1 (without any 
> PL, and if possible without sequences too?

Can't without sequences AFAIK, but you certainly can do it simpler:

select setval('seq1', 0);

select nextval('seq1'), * from
(select count(*) as numranker,gold, silver, bronzefrom countrymedalgroup by gold, silver, bronzeorder by gold desc,
silverdesc, bronze desc) ss;
 

        regards, tom lane


pgsql-sql by date:

Previous
From: David Garamond
Date:
Subject: olympics ranking query
Next
From: Bruno Wolff III
Date:
Subject: Re: olympics ranking query