, Thanks for all the great advice!
-Original Message-
From: Tom Lane [mailto:[EMAIL PROTECTED]
Sent: Monday, April 18, 2005 8:00 PM
To: Rod Taylor
Cc: Bill Lawrence; Scott Marlowe; PFC; pgsql-sql@postgresql.org
Subject: Re: [SQL] Getting the output of a function used in a where clause
Thanks Tom and Rod.
There are indeed several additional conditions on the "real" query which
prune the search space (I formulate a quick search box and filter on
Lat/Lon's within the box). Since my user interface limits the search to
a 30
mile radius, there are at most 81 results (in New York ci
Rod Taylor <[EMAIL PROTECTED]> writes:
> You can force it with a subselect though:
> SELECT * FROM (SELECT zipcode, zipdist($lat1d,$lon1d,lat,long)
> as distance
> from zipcodes) AS tab where distance <= $dist;
The above will *not* stop zipdist from being run twice
Marlowe [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 6:55 AM
To: Bill Lawrence
Cc: PFC; pgsql-sql@postgresql.org
Subject: Re: [SQL] Getting the output of a function used in a where clause
Why not just do:
SELECT zipcode, zipdist($lat1d,$lon1d,lat,long) as distance from
zipcodes where
<= $dist;
> Bill
>
>
>
> -Original Message-
> From: Scott Marlowe [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 12, 2005 6:55 AM
> To: Bill Lawrence
> Cc: PFC; pgsql-sql@postgresql.org
> Subject: Re: [SQL] Getting the output of a function used in a where clause
>
t: Re: [SQL] Getting the output of a function used in a where clause
> Boy I sure thought that would work... I received the following from
> postgres:
>
> ERROR: Attribute "distance" not found.
>
> Started looking into gist Looks complex.
>
> Any other ideas?
ERROR: Attribute "distance" not found.
>
> Started looking into gist Looks complex.
>
> Any other ideas?
>
>
> -Original Message-
> From: PFC [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 11, 2005 1:51 AM
> To: Bill Lawrence; pgsql-sql@po
M
To: Bill Lawrence; pgsql-sql@postgresql.org
Subject: Re: [SQL] Getting the output of a function used in a where clause
try:
SELECT zipcode, zipdist($lat1d,$lon1d,lat,long) as distance from zipcodes
where distance <= $dist;";
OR you could use a gist index with a geometric datatype to ge
try:
SELECT zipcode, zipdist($lat1d,$lon1d,lat,long) as distance from zipcodes
where distance <= $dist;â;
OR you could use a gist index with a geometric datatype to get it a lot
faster.
On Sat, 09 Apr 2005 03:43:39 +0200, Bill Lawrence <[EMAIL PROTECTED]>
wrote:
HI,
Iâm a newbie so please
HI,
I’m a newbie so please bear with me. I have a function defined (got it
from one of your threads… thanks Joe Conway) which calculates the distance between 2 zip code centeroids (in
lat,long). This thing works great. However, I want to sort my results by
distance without incurring th
10 matches
Mail list logo