The proper way to select using a Float column in MySQL
When doing some geocoding of addresses with the helpful Ruby Geocoder gem, I was having some issues trying to select latitudes and longitudes (which are stores as floats) from the DB.
Turns out that this:
SELECT * FROM foo WHERE latitude = -73.555
Is wrong. The proper way to select is:
SELECT * FROM foo WHERE latitude LIKE -73.555
Why this is? I don't know and I don't want to find out. Migrating this DB to Mongo soon....
Written by Lee
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Related Tags
#mysql
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#