MySQL Forums
Forum List  »  InnoDB

Need help with query with "where in" statment
Posted by: Kenneth Yeung
Date: January 17, 2006 03:11AM

I have a list of user ids that I need information from a table.

I've been using
SELECT * FROM users where users.id in (141,139,140)

I just want to know if there is a way to get MySQL to return the results in the order I give it in the set.

I need results in the form of 141 then 139 then 140

id | first_name | last_name
------------------------------------------------
141 |
139 |
140 |

instead of

id | first_name | last_name
------------------------------------------------
139 |
140 |
141 |

Any help will be much appreciated
Kenneth Yeung

Options: ReplyQuote


Subject
Views
Written By
Posted
Need help with query with "where in" statment
2348
January 17, 2006 03:11AM


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.