MySQL Forums
Forum List  »  General

Re: How to keep order of values inside IN() operator
Posted by: Peter Brawley
Date: March 26, 2011 07:04PM

See FIELD() in the manual ...

SELECT *
FROM t
WHERE id IN(7,4,9,5,1)
ORDER BY FIELD(id,7,4,9,5,1));

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: How to keep order of values inside IN() operator
March 26, 2011 07:04PM


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.