From: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Cc: | jkwast(at)home(dot)nl |
Subject: | Re: Min values? |
Date: | 2003-03-18 11:36:40 |
Message-ID: | 3E7704C8.CF2561DF@rodos.fzk.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>
> 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?
>
Why not
Select points, place_id, distance from table
WHERE distance =3D (select min( distance) from table) ;
Regards, Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | jasiek | 2003-03-18 11:37:22 | Re: Count equals 0 |
Previous Message | jack | 2003-03-18 11:17:03 | the best way to get some records not in another table |