I have a mysql table containing latitude
and longitude
followed by location name
etc and my program wants to load the data that only shown on the display, so it probably like this
e.g -6.880713 < latitude < -6.90176 AND 107.599411 < longitude < 107.635374
how can I load data using that condition?
EDIT
damn mann! i know from couple of research i found when i execute WHERE (lat < -6.90176)
it only shows up data that begins -6.9xxxxx when i search -6.8 result found 0 :D same case when i execute WHERE (lat > -6.880713)
it only shows up data that begin with -6.8xxxxx and no -6.9 :D WTF i don't understand why this is happening ~~~ no wonder the data won't shows up...
This should also work:
WHERE latitude BETWEEN -6.880713 AND -6.90176 AND longitude BETWEEN 107.599411 AND 107.635374
BETWEEN
is inclusive, though.
You can't use "math style" inequalities in MySQL. You will have to do something like:
-6.880713 < latitude AND latitude < -6.90176 AND
107.599411 < longitude AND longitude < 107.635374
-6.880713 < latitude < -6.90176
gets treated as (-6.880713 < latitude) < -6.90176
, where (-6.880713 < latitude)
will be a 1 or a 0.
WHERE latitude > -6.880713 AND latitude < -6.90176 AND longitude > 107.599411 AND longitude < 107.635374
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.