My query
select * from product where productId in(25,36,40,1,50);
Result shows as follows
`productId ProductName Qty Pr
If you want them to be randomly ordered, do:
select * from product where productId in(25,36,40,1,50) ORDER BY RAND()
The default ordering is probably due to the way the IDs are sorted in the index.
select *
from product
where productId in(25,36,40,1,50)
order by find_in_set(productId, '25,36,40,1,50');