How to keep order of values inside IN() operator
Hi,
I have maybe more theoretical question. Rather than explaining here goes the query:
SELECT * FROM t WHERE id IN(7,4,9,5,1);
The actual result is that the rows are fetched in ascending order by id - 1,4,5,7,9.
What I would like is to make possible to keep order in which are the id values inside IN() - 7,4,9,5,1. Is that possible somehow? Or do I have to rewrite completely the query to achieve that?
I cannot use ORDER BY on table t, because it doesn't contain the fields I need. The list of ids comes from other query, with lot of joins and many tables involved and is not important right now. My wish would be just to re-use the order in one single query.
Thanks a lot for any advice,
Luk