Quote:
Originally Posted by Jakez
Nah sorting by ID (which pretty much goes in order just like the dates) because I need exactly 14 posts on each page regardless of how many were posted that day.
I've got it working how I want now, I just queried the latest 14 posts, stuck them in a multidimensional array and sorted that by views. Next page will grab the next 14 and sort them by views, etc..
Still don't understand why using 2 ORDER's in a query isn't working..
|
You can do it in a sub select but you can't do it the way you are trying to do it.
The order by clause on your query is saying to sort the entire table by the order by clause and then give you the 14 you want. You dont want the entire table sorted by views, you just want the 14 that will be on your current page sorted by views.
To do it in one query (which is actually 2) and get the results you want would be:
select * from (select * from tablename order by id desc limit X,14) order by views desc