I found a lot of similar messages and even tried to figure out how to handle negative values ββin MySQL, but to no avail.
I have a website where I use Google Maps, and as a performance improvement, I limit the markers that are drawn on the map to those that are on the borders of the map.
I would like to develop a query that will work with positive or negative latitude and longitude values.
For the database:
latitude FLOAT( 10, 6 ) longitude FLOAT( 10, 6 )
Request:
SELECT * FROM `table` WHERE `latitude` BETWEEN 47.926930 AND 47.929806 AND `longitude` BETWEEN -97.077303 AND -97.083997
If I omit the BETWEEN clause for longitude , I get results, albeit incorrect with the longitude constraint.
I tried this:
AND -`longitude` BETWEEN ABS( -97.077303 ) AND ABS( -97.083997 )
Which works, but only for negative longitude values.
Does longitude need to be checked if its negative?
mysql select latitude-longitude
hungerstar
source share