Sorting the Enum Filed value in Mysql
Hi,
I’m trying to sort the Enum filed integer value with my own level of priority. i try in google and get the lots of result with irrelavent matches and finally i got the solution.
We can sort the enum values by using the ORDER BYoption
The index can also be used even if the ORDER BY does not match the index exactly, as long as all of the unused portions of the index and all the extra ORDER BY columns are constants in the WHERE clause.
Here is the example i used the sorting inn my own
Selecte * from table order by FIELD ( column_name , ‘ 8′,’7′,’2′,’1′,’5′,’4′);
I think it also help for you guys
enjoy the Day
Advertisement























No trackbacks yet.