Order by field is one such way:
select * from TABLE order by FIELD(column_name,4,3,2,1,5) ;
You can look into this for more details:
Pregunta
I have data along with the ids 1,2,3,4,5 but these are not primary ids... I want to fetch data in order like 4,3,2,1,5. I cann't change the ids in database.If i use order by desc it will fetch 5,4,3,2,1.
Solución 2
Order by field is one such way:
select * from TABLE order by FIELD(column_name,4,3,2,1,5) ;
You can look into this for more details:
Otros consejos
you can use FIELD in order clause
order by FIELD(field_name,4,3,2,1,5)
you can use ORDER BY RAND()
for random order.
Try this,
SELECT table.* FROM table ORDER BY FIELD(id,4,3,2,1,5);