Re: Can function results be used in WHERE?

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: "Bryce Nesbitt" <bryce1(at)obviously(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Can function results be used in WHERE?
Date: 2006-07-10 22:33:57
Message-ID: bf05e51c0607101533ld2ee15fm4cff4f7ce23a320a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 7/10/06, Bryce Nesbitt <bryce1(at)obviously(dot)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;

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Browne 2006-07-11 00:12:51 Re: MS-SQL<->Postgres sync
Previous Message Bryce Nesbitt 2006-07-10 22:08:07 Re: Can function results be used in WHERE?