Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do you keep the order using SELECT WHERE IN()?

User_19BPUSep 17 2012 — edited Sep 17 2012
Hi,

Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:

SELECT id FROM data_table WHERE id IN('56','55','54','1','7');

The results will come back using the default order by id. 1,7,54,55,56

When I want to keep the order used in the IN: 56,55,54,1,7

Is there a quick way to do this in mySQL or will I be forced to order it after in code.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2012
Added on Sep 17 2012
9 comments
4,170 views