View Single Post

   
  #2 (permalink)  
Old 03-01-2008, 11:35 AM
matthewf_boi@yahoo.com
 
Posts: n/a
Default Re: SQL to calculate surrounding suburbs

Pacific Fox wrote:
> Hello all,
> Does anyone know the SQL statement for calculating surrounding suburbs,
> or can point me in the right direction?
> I have a database of Australian postal codes and their centroids in
> longitude and latitude, I'd like to pass it either the long/lat or
> postal code to calculate from. And preferably return distance as well,
> in KM..
>
> Thanks in advance.


is this Oracle or MSSQL? Oh well, it probably doesn't matter.

Try this:
select myzip as varchar(32) from centroids
join long_lat on zip_code = coordinate
where distance < .75km
and postcode in (4101, 4106, 4000, 2580 4169)

I am pretty sure that should take care of it for you.
Regards

Reply With Quote