Reputation: 947
I have MySQL database of areas in a city. The attributes of each area are: lat , lng, SWLat, SWLng, NELat, NELng.
I need help in writing a query the tells me the area for a given location, which consists of Lat & Lng.
Thanks in advance, Sal.
Upvotes: 1
Views: 83
Reputation: 12983
Not really enough information, but this would appear to fit the bill:
SELECT * FROM table WHERE
myLat >= SWLat AND myLat <= NELat AND
myLng >= SWLng AND myLng <= NELng
myLat
and myLng
are the coordinates of the location for which you are trying to find the containing region.
Upvotes: 2