您的位置:首页 > 产品设计 > UI/UE

SQL Server orderby with some fixed values

2012-03-09 11:15 381 查看
I came across a problem when we want to set the default language to English in a dropdown list. Such as:

Chinese
Danish
English
German
Japanese
Swedish


We want the English come to the first, and the rest follows That’s:

English    //go to first
Chinese
Danish
German
Japanese
Swedish


 

We can do this by uniting the two SQL result sets:

select * from country where lang='English'
union
select * from country where lang<>'English'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐