Min values?

From: "J(dot)C(dot)M(dot) van der Kwast" <jkwast(at)home(dot)nl>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Min values?
Date: 2003-03-17 16:48:27
Message-ID: 003901c2eca5$08c08970$04a779d9@cc299057a
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Sjors 2003-03-17 17:09:31 howto?
Previous Message Rajesh Kumar Mallah 2003-03-17 14:54:03 Re: Formatting intervals..