> I can code to select latitudes BETWEEN certain values. But it won't work
> with the LONGITUDES.
> eg: I'd like to say
> select count(*) from test_table where latitude between 40.589506 and
> 40.589992
> and longitude between -73.922080 and -73.922420.
>
> I should only get 10 out of the above rows. I get none.
> Both Latitude and Longitude are defined as decimal 9 6
> Could anyone offer any guidance?
> TIA
> Kieran Ames
>
Reading The Fine Manual:
--
expr BETWEEN min AND max
If expr is greater than or equal to min and expr
is less than or equal to max, BETWEEN returns 1,
otherwise it returns 0. This is equivalent to the
expression (min <= expr AND expr <= max) if all the
arguments are of the same type.
--
I.e. you must put the smallest of the two numbers
(the numerically larger of the negative values)
before 'and' like so :
select count(*) from test_table
where latitude between 40.589506 and 40.589992 and
longitude between -73.922420 and -73.922080.
/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq