MySQL Forums
Forum List  »  Newbie

Re: Sorting by DATE and then by ID when dates are same
Posted by: Michael Black
Date: September 04, 2008 04:23AM

Hi Ron,

Yes I am, if this is the way to go. Tried what you suggested.

You seemed to have solved part 2 ok - 2)have multiple news articles with same date.

However still points to the next highest ID, missing the date in the middle

ie. from 1002 to 1005, instead of going to 235.

ID ----- Date
1005 --- 2008-08-28
235 ---- 2008-08-27
1002 ----2008-08-26

I need to sort by ART_DATE all the time, save when there multiple articles with the same date. Then requiring me to look at the ID and then ORDER on that.

ie.

IF ART_DATE = $art_date THEN ID > $id
ELSE ART_DATE > $art_date

Something like that..

I'm wondering whether this IF...THEN or CASE condition needs to follow the WHERE statement.


I'm a bit stumped.

"A laugh a day - keeps insanity away" - me ... HAhah



Edited 2 time(s). Last edit at 09/04/2008 05:00AM by Michael Black.

Options: ReplyQuote


Subject
Written By
Posted
Re: Sorting by DATE and then by ID when dates are same
September 04, 2008 04:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.