Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
hi,



I want a query like display the particular name first after that the order by continues by alphabetical order

SQL
SELECT *
FROM MDT_Organisation_Master
ORDER BY (Organisation_ShortCode = 'Mewaholeo') , Organisation_ShortCode asc




first i want all the details related to Mewaholeo then remaining from a-z(Ordering)

Thank You
Posted

1 solution

Try..
SQL
SELECT *
FROM MDT_Organisation_Master
ORDER BY CAse When Organisation_ShortCode = 'Mewaholeo' THEN '1'
Else  Organisation_ShortCode asc


ref here.
http://sqlandme.com/2013/11/18/sql-server-custom-sorting-in-order-by-clause/[^]
 
Share this answer
 
Comments
Rajesh waran 11-Feb-15 2:51am    
5*
/\jmot 11-Feb-15 2:52am    
thank you. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900