View Single Post
Old 02-17-2011, 11:46 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,066
Quote:
Originally Posted by Jakez View Post
I'm trying to sort the order by 2 INT columns but it doesn't seem to recognize the 2nd sort.

Everything in Google says to do it like this:


But that gives me this, which is only sorting the ID's and not the views also:
Since Id is the first sort parameter it sorts by that first, then within id it sorts by views.

It appears that id is unique in your database so there will never be more than one instance of id in the list, so what you actually want to do is just sort by views desc to put it into the proper order.

Select.................order by views desc, id (you do not have to specify asc on id it will default to asc)

That should produce:

5....1
12...1
4...0
6...0
............
__________________
All cookies cleared!

Last edited by sarettah; 02-17-2011 at 11:49 PM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote