There is a mysql query
SELECT `temp`.* FROM (SELECT `price`.`Code`,`price`.`Name`,`price`.`Warranty`,`price`.`Price` FROM `price` ORDER BY `price`.`Price`) AS temp
The request does not sort by price
. Price
Those. gives out not sorted data. At the same time request
SELECT `price`.`Code`,`price`.`Name`,`price`.`Warranty`,`price`.`Price` FROM `price` ORDER BY `price`.`Price`
works fine. Tell me what could be the problem?
I introduce an amendment to the question:
In fact, my query looks like this:
SELECT `temp`.* FROM (SELECT `price`.`Code`,`price`.`Name`,`price`.`Warranty`,`price`.`Price`,(@rownum:=@rownum+1)as num FROM (SELECT @rownum:=0) AS initialisation,`price` ORDER BY `price`.`Price` LIMIT 41) AS temp WHERE `num`>=21 and `num`<41
I need to sort the goods by price and take 20 consecutive elements from the sorted ones. In some cases, the option with LIMIT works, in some it is not. I can not understand how in this case to do.