Search Postgresql Archives

Re: ranked subqueries vs distinct question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 14, 2008 at 08:21:00AM -0700, Stephan Szabo wrote:

> Can't you just do something like order by name, rank as part of the
> distinct on subselect to force it to pick the rank 1 row for a given name?
> 
> So, basically
> select * from
>  ( select distinct on ... order by name, rank )
> order by rank, name;

OK, ordering twice, ..., once to bubble up by rank so the
distinct on picks the rank 1 sub-results ..., second to time
get the final order by name within the ranks. Sounds like an
idea I didn't think of. Will try that. Thanks for the
suggestion !

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux