order by FIELD(排序列,value1,value2....) desc/asc
select * from sy_cd_ms_base_hospital_info order by FIELD(grade,"三甲","三乙","三丙","二甲") asc
图中按照"三甲","三乙","三丙","二甲"的顺序排列,没有在排序中包含的排在了上面
select * from sy_cd_ms_base_hospital_info order by FIELD(grade,"三甲","三乙","三丙","二甲") desc
图中按照"三甲","三乙","三丙","二甲"降序排列,没有在排序中包含的排在了下面.
如果想按照排序顺序升序排列并且没有包含在排序值中的数据排在最后(使用最多的情况)如何写呢?
select * from sy_cd_ms_base_hospital_info order by FIELD(grade,'二甲','三丙','三乙','三甲') desc
把想要排序的降序写,再按降序排