Greater Than and Less than MySql query failing with decimal field -


i have database has 3 columns:

user_id | lat      | lon 1       |-1.403976 | 53.428692 2       |-1.353276 | 55.224692 etc etc        

both lat , lon set decimal fields. i'm running query similar isn't filtering based on being greater , less given lat/lon numbers:

select * `table` `lat` < '-1.399999' , 'lat' > '-1.300000'  , 'lon' < '55.555555' , > '53.000000' 

this query returns every row in table , don't know why? fields being set decimals?

i hope can - know simple answer if know it.

as per comment - here's create table:

create table if not exists `members` ( `user_id` int(10) not null auto_increment, `lat` decimal(8,6) not null, `lon` decimal(8,6) not null, unique key `user_id` (`user_id`), ) engine=innodb  default charset=latin1 auto_increment=136 ; 

the problem wrapping column names single quotes forcing decimal values compare against string literals. column names tables name identifiers not string literals shouldn't wrap single quotes.

and `lat` > '-1.300000'  , `lon` between '55.555555' , '53.000000' -- use between here 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -