I want to order by a string in SQL query like
Select * From employees ORDER BY names (mark, mac , jack, steve)
Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In standard SQL, you need a
case
statementYou can find this article helpful for you in case you are using Oracle database:
Oracle Case Statement : (Simple Case, Searched Case)
Some SQL engines have shortcuts to this, but you don’t mention which database you are using.
For instance, in MySQL you can do: