This blog will teach you how to sort Data In Mysql Based On Field Value Of a column
We can sort data based on field value of a column by using ORDER BY FIELD () in mysql.
Database : world
Table name : country
If i will execute the below query :
“select distinct Continent from country” then i will get the output as :
Let say that we want to sort the data in a specific order by “Asia,Africa,North America,South America,Antarctica,Oceania,Europe”.
So in this case we can not perform simply order by because either by ascending or descending , we can not get our required output.
So let’s use the below query :
“select distinct Continent from country
order by field (Continent,’Asia’,
And we will get the output as required:
Best Open Source Business Intelligence Software Helical Insight is Here