i have a large db. i want to sort things on 2 variables: price(1st) and the number of orders( 2nd). ordered by the first var and subordered by the second: eg: 100 (1st var) 80 (2nd var) is before 100 (1st var) 79 (2nd var) 100 (1st var) 78 (2nd var) 99 (1st var) 89 (2nd var) 99 (1st var) 69 (2nd var) etc
ORDER BY supports more than one column...
thank that works!
next time i'll read the manual 1st!
Note that is you use the ASC or DESC keywords, they work independently on each column:
select * from table order by field1 ASC, field2 DESC
Most databases cannot use a multi-column index for the second field in this circumstance.