Re: howto/min values - Mailing list pgsql-sql

From Sjors
Subject Re: howto/min values
Date
Msg-id 002b01c2ee29$4c57d690$04a779d9@cc299057a
Whole thread Raw
In response to Re: howto/min values  (Christoph Haller <ch@rodos.fzk.de>)
List pgsql-sql
> >
> No, not at all. Something like
> 
> select p.points, p.id, p.distance from
> (select points, id, (x-x) as distance from table) as p
> where p.distance = (select min(p1.distance)
> >                             from table as p1
> >                             where p.points=p1.points)
> > order by p.points, p.id ;
> 
> should do the trick.
> The FROM clause allows any kind of subqueries within parentheses.
> 
> Regards, Christoph
> 
Thanks, this is the solution.

greetz Sjors


pgsql-sql by date:

Previous
From: Victor Yegorov
Date:
Subject: Re: vacuum all but system tables
Next
From: cliff@cliffmeyers.com
Date:
Subject: integrity of column used to order rows