SELECT * FROM it_catalog_index WHERE PRICE <= 100 ORDER BY RAITING_TOTAL DESC LIMIT 0 , 9000 PRICE int(11) 

Does not work at all, displays all records.

 CREATE TABLE IF NOT EXISTS `it_catalog_index` ( `ID` int(10) unsigned NOT NULL COMMENT 'restaurant ID', `ACTIVE` tinyint(1) DEFAULT '1', `NAME` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'or dish name', `ADDRESS` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'address', `CITY` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'city name', `METRO` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'metro station name', `METRO_ID` int(11) DEFAULT NULL COMMENT 'id metro station', `TYPE` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'type name', `CITY_ID` int(11) DEFAULT NULL COMMENT 'restaurant city ID', `TYPE_ID` smallint(6) DEFAULT NULL COMMENT 'restaurant type ID', `COUNTRY_ID` int(11) DEFAULT NULL COMMENT 'restaurant country ID', `DELIVERY` smallint(6) DEFAULT NULL COMMENT 'restaurant delivery - 1 if true, 0 if false', `PRICE` int(11) DEFAULT NULL COMMENT 'price for delivery service', `DELIVERY_TIME` int(11) DEFAULT NULL COMMENT 'delivery time', `DELIVERY_MIN_ORDER` int(11) DEFAULT NULL COMMENT 'minimal order summ for a delivery service', `RAITING_TOTAL` double DEFAULT NULL COMMENT 'reiting', PRIMARY KEY (`ID`), KEY `COUNTRY_ID` (`CITY_ID`,`COUNTRY_ID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 
  • Grammar nazi comment: The RAITING_TOTAL field explicitly added a prog program without a language. Two whole variants of the incorrect spelling of the word "rating": the field itself, and the comment) - Sergiks

3 answers 3

Hmm .. Why do you write LIMIT ?

I do not know, I do not see anything wrong. The only thing you can try:

 SELECT * FROM `it_catalog_index` WHERE `PRICE` <= 100 ORDER BY `RAITING_TOTAL` DESC 
  • ORDER BY RAITING_TOTAL DESC And here with quotes not overdo it? He will say, after all, that such a column has not been found - knes
  • I'm still testing, but nothing has changed. - Tchort
  • overdone, SELECT * FROM it_catalog_index WHERE PRICE <= 100 ORDER BY RAITING_TOTAL DESC - stasQa

The <= operator in MySQL is, and the problem is clearly not in it. Table in the studio

  • added table - Tchort
  • Everything works for me too, mysql 5.1.46 - Snow

The query for this table works fine, checked in MySql 5.5.25 for Windows, most likely not in the query case.