Re: Can function results be used in WHERE? - Mailing list pgsql-sql

From Aaron Bono
Subject Re: Can function results be used in WHERE?
Date
Msg-id bf05e51c0607101533ld2ee15fm4cff4f7ce23a320a@mail.gmail.com
Whole thread Raw
In response to Re: Can function results be used in WHERE?  (Bryce Nesbitt <bryce1@obviously.com>)
Responses Re: Can function results be used in WHERE?
List pgsql-sql


On 7/10/06, Bryce Nesbitt <bryce1@obviously.com> 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; 

pgsql-sql by date:

Previous
From: Bryce Nesbitt
Date:
Subject: Re: Can function results be used in WHERE?
Next
From: Bryce Nesbitt
Date:
Subject: Re: Can function results be used in WHERE?