Order by with a particular value on TOP

Viewed 12675

I have a requirement to order a list of countries alphabetically but with a specific country on TOP. After that country it should be ordered alphabetically . Example

India
Afghanistan
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antigua and Barbuda
Argentina
Armenia
Aruba 

........... I tried the answer provided here Sorting certain values to the top but it was not working I am using PL/SQl dev tool. Thanx in Advance

5 Answers

you can try this.

SELECT * 
FROM `country` 
ORDER BY CASE WHEN countyName = 'india' THEN 1 ELSE 2 END, countyName ASC
Related