MySQL Forums
Forum List  »  InnoDB

Re: Sort (ORDER BY) by a comma-separated list of related fields using MySQL 4.1?
Posted by: Roland Bouman
Date: February 22, 2008 03:49AM

Hi!

...
ORDER BY CASE nid
WHEN 3110 THEN 1
WHEN 3060 THEN 2
WHEN 3107 THEN 3
END

(http://dev.mysql.com/doc/refman/5.1/en/control-flow-functions.html#operator_case)

or:

ORDER BY FIND_IN_SET(nid,'3110,3060,3107')

(http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_find-in-set)

I hope this helps,

Roland Bouman
http://rpbouman.blogspot.com/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Sort (ORDER BY) by a comma-separated list of related fields using MySQL 4.1?
2718
February 22, 2008 03:49AM


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.