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 the additional burden of executing the function
twice. A simplified version of my current SQL (written in a perl cgi) that returns a set of zip codes within a
given radius is: $sql = “SELECT zipcode from zipcodes where zipdist($lat1d,$lon1d,lat,long) <= $dist;”; What I want to write is something like: $sql = “SELECT zipcode, distance from zipcodes where distance <= $dist order by distance;”; But I don’t the magic SQL phrase to populate the distance variable using my nifty function. Do I need to create an output type for distance? Thanks in advance! Bill |
- [SQL] Getting the output of a function used in a where claus... Bill Lawrence
- Re: [SQL] Getting the output of a function used in a wh... PFC
- Re: [SQL] Getting the output of a function used in ... Bill Lawrence
- Re: [SQL] Getting the output of a function used... Scott Marlowe
- Re: [SQL] Getting the output of a function ... Bill Lawrence
- Re: [SQL] Getting the output of a func... Rod Taylor
- Re: [SQL] Getting the output of a ... Tom Lane
- Re: [SQL] Getting the output o... Bill Lawrence
- Re: [SQL] Getting the output o... PFC
- Re: [SQL] Getting the output of a function used in a wh... Bill Lawrence