Aaron Bono wrote:
>
>
> On 7/10/06, *Bryce Nesbitt* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
>     I think it is ugly also, but no other syntax seems to work:
>
>     stage=# select
>     pod_code,lat,lon,calculate_distance(lat,lon,37.789629,-122.422082) as
>     dist from eg_pod where dist < 1 order by dist desc limit 10;
>     ERROR:  column "dist" does not exist
>
>
> SELECT
>    pod_code,
>    lat,
>    lon,
>    calculate_distance(lat,lon,37.789629,-122.422082) as dist
> FROM eg_pod
> WHERE calculate_distance(lat,lon, 37.789629,-122.422082) < 1
> ORDER BY calculate_distance(lat,lon,37.789629,-122.422082) desc limit 10;
Yep, that works.  I guess with IMMUTABLE it's even effecient.
But I have to pass 6 arguments, not 2.  Is there a way to make it look
cleaner?
I had expected using the column label (e.g. "dist") to work with WHERE,
just as it does with ORDER BY.

                               -Bryce


-- 
----
Visit http://www.obviously.com/


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to