From: J.C.M. van der Kwast <jkwast@home.nl>
To: pgsql-sql@postgresql.org
Subject: Min values?
Date: Mon, 17 Mar 2003 17:48:27 +0100
Message-ID: <003901c2eca5$08c08970$04a779d9@cc299057a> (raw)
Hi,
I don't seem to grasp the anwser on this problem. I've got a table with points, place_id's and distance between points and place_id. I want to select the points and place_id with smallest distance. I've tried statemeants like this but with no results that I like:
Select points, place_id, distance from table
group by points, place_id, distance
having points= (select points from table having distance = (select min(distance) from table)
The only result I'm getting is the min value of distance. I want to have the points, place_id with distance = min(distance). Any suggestions?
greetz Sjors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jkwast@home.nl
Subject: Re: Min values?
In-Reply-To: <003901c2eca5$08c08970$04a779d9@cc299057a>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox