October 29, 2009 at 4:03 am
I have a table languagemaster having values
urdu
hindi
malyalam
bengali
punjabi
kanada
telugu
I want to have the result with a sql query in following form:
English
Hindi
Punjabi
bengali
kanada
malyalam
telugu
urdu
Means first i want English,Hindi,Punjabi
then rest of the languages in alphabetical order.
Please help me in writing this query.
October 29, 2009 at 4:15 am
you need to ...
ORDER BY Case when language in ('English','Hindi','Punjabi') then 0 else 1 end,language
October 29, 2009 at 7:34 am
Nice solution David. I was going to suggest that an ordering column in the table would be necessary. It may still be if the other languages come out of alphabetical order.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 29, 2009 at 7:44 am
I second Jack's praise, this will come in as a handy addition to what I'm trying to do (http://www.sqlservercentral.com/Forums/Topic810762-338-1.aspx)
Thanks!
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply