Quote:
Originally Posted by sarettah
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
|
I tried a sub select earlier, it gave me this error earlier and gives me the same error trying this one.
#1248 - Every derived table must have its own alias
I think sub select is meant to be used with multiple tables? Idk I've never used em..
Edit: oh I needed to place it into an alias like
select * from (select * from tablename order by id desc limit X,14) as aliasname order by views desc
Does the trick thanks dude!