I have a simple query:
SELECT data FROM table WHERE id IN (5, 2, 8, 1, 10)
The question is how can I select my data and order it, as in my IN.
Order must be 5, 2, 8, 1, 10.
The problem is that I do not have a key for the order. IN from another request (1), but I need a secure order.
Any solutions?
(1)
SELECT login FROM posts LEFT JOIN users ON posts.post_id=users.id WHERE posts.post_n IN ( 2280219,2372244, 2345146, 2374106, 2375952, 2375320, 2371611, 2360673, 2339976, 2331440, 2279494, 2329266, 2271919, 1672114, 2301856 )
Thanx for help, solutions work, but very slow, maybe finding something better later than anyway