SQL中基于值的排序 [英] value based sorting in SQL
本文介绍了SQL中基于值的排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望查询之后首先显示特定名称按字母顺序继续订购
I want a query like display the particular name first after that the order by continues by alphabetical order
SELECT *
FROM MDT_Organisation_Master
ORDER BY (Organisation_ShortCode = 'Mewaholeo') , Organisation_ShortCode asc
首先,我想了解与Mewaholeo相关的所有细节然后从az(订购)继续
谢谢你
first i want all the details related to Mewaholeo then remaining from a-z(Ordering)
Thank You
推荐答案
试试..
Try..
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-子句/ [ ^ ]
这篇关于SQL中基于值的排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文