View Single Post
Old 02-18-2011, 02:18 AM  
bbobby86
partners.sexier.com
 
bbobby86's Avatar
 
Industry Role:
Join Date: Jan 2007
Location: San Francisco, CA
Posts: 11,926
Quote:
Originally Posted by sarettah View Post
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
............
Yes. Totally right, if you want to do that. ...
Id is your primary key... just order by views desc, id;
__________________

bbobby86 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote