Reputation: 628
SELECT * FROM `fz_users` WHERE `id` in ('6', '1', '30', '34', '11', '3', '2', '7', '4', '24', '221')
I am using this query to show the user data and 6,1,30.... are the ids of the user but my problem is that i need in the same order like I am giving in it ie 6,1,30,34,11,3,2
Upvotes: 0
Views: 35
Reputation: 5049
Try
SELECT * FROM your_table
WHERE id IN ('6', '1', '30', '34', '11', '3', '2', '7', '4', '24', '221')
ORDER BY FIELD(id,'6', '1', '30', '34', '11', '3', '2', '7', '4', '24', '221');
Upvotes: 4