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.
Asked
Active
Viewed 150 times
0
-
Please show your data, your schema and what you really want to try to achieve. "order like 4,3,2,1,5" looks completely random. – Bart Friederichs Jan 29 '14 at 07:33
-
you need some field you can sort with. some column which would help you to fetch in that order – Furquan Khan Jan 29 '14 at 07:35
-
This should be your answer [php mysql sort results by order fetched](http://stackoverflow.com/questions/12459816/php-mysql-sort-results-by-order-fetched/12459958#12459958) – Rahil Wazir Jan 29 '14 at 07:51
4 Answers
1
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:

Community
- 1
- 1

Furquan Khan
- 1,586
- 1
- 15
- 30