When querying the db for a set of ids, mysql doesnot provide the results in the order by which the ids were specified. The query i am using is the following:
If you want to order your result by id in the order specified in the in clause you can make use of FIND_IN_SET as:
id
in clause
FIND_IN_SET
SELECT id ,title, date FROM Table WHERE id in (7,1,5,9,3) ORDER BY FIND_IN_SET(id,'7,1,5,9,3')