X-Original-To: pgsql-sql@postgresql.org Received: from mail6-sh.home.nl (mail6.home.nl [213.51.128.20]) by postgresql.org (Postfix) with ESMTP id 6DE1A474E53 for ; Mon, 17 Mar 2003 11:48:17 -0500 (EST) Received: from cc299057a ([217.121.167.4]) by mail6-sh.home.nl (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with SMTP id <20030317164822.DXXQ21331.mail6-sh.home.nl@cc299057a> for ; Mon, 17 Mar 2003 17:48:22 +0100 Message-ID: <003901c2eca5$08c08970$04a779d9@cc299057a> From: "J.C.M. van der Kwast" To: Subject: Min values? Date: Mon, 17 Mar 2003 17:48:27 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0036_01C2ECAD.6A5BBE90" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Archive-Number: 200303/407 X-Sequence-Number: 12446 This is a multi-part message in MIME format. ------=_NextPart_000_0036_01C2ECAD.6A5BBE90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I don't seem to grasp the anwser on this problem. I've got a table with poi= nts, 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=3D (select points from table having distance =3D (select min(= distance) from table) The only result I'm getting is the min value of distance. I want to have th= e points, place_id with distance =3D min(distance). Any suggestions? greetz Sjors ------=_NextPart_000_0036_01C2ECAD.6A5BBE90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I don't seem to grasp the anwser on t= his=20 problem. I've got a table with points, place_id's and distance between poin= ts=20 and place_id. I want to select the points and place_id with smallest distan= ce.=20 I've tried statemeants like this but with no results that I like:
 
Select points, place_id, distance from=20 table
group by points, place_id, distance=
having points=3D (select points from = table=20 having distance =3D (select min(distance) from table)
 
The only result I'm getting is the min val= ue of=20 distance. I want to have the points, place_id with distance =3D= =20 min(distance). Any suggestions?
 
greetz Sjors  
------=_NextPart_000_0036_01C2ECAD.6A5BBE90--