数据库按固定的字段值排序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_16765615/article/details/86478350
获取前十条 按照RELATION值为 分、属、参 前后顺序进行排序
select * from (
  SELECT TARGETDESCRIPTOR FROM DESCRIPTOR_RELATION WHERE 1=1 AND ( "RELATION" = '分' OR "RELATION" = '属' OR "RELATION" = '参') and "SOURCEDESCRIPTOR_ID" = #{UUID} ORDER BY case when "RELATION" = '分' then 1 when "RELATION" = '属' then 2 when "RELATION" = '参' then 3 end
  ) a where  rownum <= 10

猜你喜欢

转载自blog.csdn.net/qq_16765615/article/details/86478350
今日推荐