MySQL Forums
Forum List  »  Newbie

Re: Sort by a givin siquence in "WHERE" clause?
Posted by: Roland Bouman
Date: July 27, 2005 03:45AM

you can't - at least not directly.
You can set up an expression in the order by clause:

ORDER BY case id
when 1 then 3
when 2 then 1
when 3 then 2
...
end

but if the order is that important, i recommend you add a column to your table that stores the preferred ordering position, and youse that in the order by clause.

Options: ReplyQuote


Subject
Written By
Posted
Re: Sort by a givin siquence in "WHERE" clause?
July 27, 2005 03:45AM


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.