Hi, im working with google maps and im and trying to do this, but i cant
make a good query of it.

I want to select elements between a given latitude and longitude from this
table:

*CREATE TABLE `images` (*

*`id_img` bigint(20) unsigned NOT NULL auto_increment,**
**`filename` char(50) NOT NULL,**
**`extension` enum('jpg','jpeg','gif','png') NOT NULL,**
**`lat` float(10,6) NOT NULL,**
**`lng` float(10,6) NOT NULL,*

*PRIMARY KEY (`id_img`),**
**KEY `lat` (`lat`,`lng`)
**) ENGINE=InnoDB  DEFAULT CHARSET=utf8*

**

**

**


im trying with this query and some similars but all of them scans all the
table, and i dont know why


SELECT *
FROM `images`
WHERE lat BETWEEN 29.993002 AND 49.410973
AND lng BETWEEN -40.209960 AND 32.871093


id   select_type   table        type        possible_keys      key
key_len           ref           rows     Extra
1    SIMPLE        images    ALL         lat                       NULL
 NULL               NULL      108      Using where


thanks in advance

Reply via email to