SELECT MIN(PRICE) AS MinPrice, MAX(PRICE) AS MaxPrice FROM (SELECT PRICE FROM PRICES LIMIT 10) tmp;
in addition, MySQL has a cool function that will allow you to return an arbitrary row of rows (for example, return rows 10-20). This is very convenient for displaying post pages:
SELECT column FROM table LIMIT 10 OFFSET 20
The above query will return lines 20-30.
So, to return lines from 20 to 30 in case of your request, you use:
SELECT MIN(PRICE) AS MinPrice, MAX(PRICE) AS MaxPrice FROM (SELECT PRICE FROM PRICES LIMIT 10 OFFSET 20);
You need to change the offset value to indicate the starting point of your range.
reggie
source share