List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:February 24 2000 11:14pm
Subject:Re: Zip codes...
View as plain text  
In the last episode (Feb 24), Roy Nasser said:
> Hello,
> 
> I am from Brasil (As many may know... :)) and i want to do some sql stuff
> with Zipcodes...
> 
> I think that it is acceptable due to the way that the postal system works
> here to use the numbers closest...i.e.

If you mean closest in the mathematical sense, 

SELECT zipcode FROM table ORDER BY ABS(zipcode-$myzip)

will work.  If you want true geographic locality, you'll have to store
X + Y coordinates for each zipcode or something similar, and order by
abs(zipx-my_x) * abs(zipy*my_y) .

-- 
	Dan Nelson
	dnelson@stripped
Thread
Zip codes...Roy Nasser25 Feb
  • Re: Zip codes...Dan Nelson25 Feb
    • RE: Zip codes...Roy Nasser25 Feb
      • Re: Zip codes...Dan Nelson25 Feb
        • RE: Zip codes...Roy Nasser25 Feb
          • Re: Zip codes...Dan Nelson25 Feb
            • RE: Zip codes...Roy Nasser25 Feb
              • Re: Zip codes...Benjamin Pflugmann25 Feb
    • Re: Zip codes...James Treworgy25 Feb
  • Re: Zip codes...Graeme B. Davis25 Feb
    • Re: Zip codes...James Treworgy25 Feb
      • Re: Zip codes...Robert Crawford25 Feb