Zach
Zach

Reputation: 10129

Sql Query Between two double values

I am using a sql query to fetch all shops between two latitudes and longitudes. The query is given below

    SELECT ID FROM venues WHERE
(latitude BETWEEN 41.439998626708984 AND 41.939998626708984 ) AND
(longitude BETWEEN 2.1800000667572021 and 2.6800000667572021);

But this query is not returning any values where as the same query with two precision in floating values is returning the result. That query is given below

SELECT ID FROM yupii_eventlist_venues WHERE
(latitude BETWEEN 41.43 AND 41.93) AND
(longitude BETWEEN 2.18 and 2.68);

I am using MySQl. Could someone help me to make this right.

Thanks.

Upvotes: 4

Views: 7547

Answers (1)

Dex
Dex

Reputation: 78

You need to setup your fields as floats with specific rules. I use float(10,6) for Lats and Longs.

Upvotes: 2

Related Questions