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
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.