Need help with attributes...

From: Scott Holmes <sholmes(at)pacificnet(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Need help with attributes...
Date: 2000-05-02 19:48:26
Message-ID: 390F310A.C0CFC8EE@pacificnet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I created a latitude/longitude function (it's Richard Lynch's, actually)
that returns the distance between to points. What I don't know how to
do is use this value as a filter in the select statement:

PostgreSQL Error: 1 (ERROR: Attribute 'distance' not found )
select distinct zip_code, gpsdistance(34.2865, 118.435, latitude,
longitude) as distance from zipcodes where distance
<= 10.0

The value for distance is actually available, however:

select distinct zip_code, gpsdistance(34.2865, 118.435, latitude,
longitude) as distance from zipcodes where zip_code
like '913%'

91301 16.3049416821461,
91302 12.858968990111,
91303 8.71667347958831,
91304 8.67013652211651,
91305 8.45399567001425,
91306 .....

Any assistance on this question of syntax would be gratefully accepted

--
---------------------------------------------------------------------
Scott Holmes http://www.pacificnet.net/~sholmes
sholmes(at)pacificnet(dot)net

Independent Programmer/Analyst Passport 4GL
HTML Composer Informix 4GL, SQL
---------------------------------------------------------------------
There are more things in heaven and earth, Horatio,
than are dreamt of in your philosophy
---------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2000-05-02 20:20:40 Re: Need help with attributes...
Previous Message Michael Simcich 2000-05-02 18:33:40 Setting up PGSQL 7 on Win2K