Is there a way to get some selected data first & rest data in ascending order through SQL Query.
Suppose I have country data in unmannered way (not in sequence) in table tbl. Now I want to show Country 'United States','Canada' & 'India' first & rest of the country shown in ascending order.
Country India China Brazil Azerbaijan Bahamas United State Denmark Canada
Country United State // US,Canada,India should be First 3. Canada India Azerbaijan // After rest country comes in ascending Order. Bahamas Brazil China Denmark
select * from tblName Order by case When country = 'United State' then 1 when country = 'Canada' then 2 when country = 'India' then 3 else 4 end , country
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)