Jump to content


Photo

Order by 2 rows?


  • Please log in to reply
2 replies to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 12 September 2006 - 02:35 PM

I'm wanting to order my news by date but if 3 articles are posted on 1 day, they arn't in order of time. So how do I order by id (each time it is submitted it is given an ID, latest news = biggest ID number).

Something like this:

ORDER BY date DESC && ID DESC LIMIT 1

Thanks.
~ Mutley.

#2 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 12 September 2006 - 02:36 PM

ORDER BY date, id DESC


#3 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 12 September 2006 - 02:37 PM

ORDER BY date DESC, ID DESC LIMIT 1

ahh... beaten.  Good one, Jenk... but at least my example shows that you can sort both ASC/DESC.

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users