概述
多条件排序可以通过在order by语句后面使用case when then条件语句来实现。
select * from 表名 ORDER BY case when 条件 then 0 else 1 end
下面用实例演示下:
实例
1.创建表case_test
共有id,case_type,case_location,case_way四个字段。
create table case_test(id number(5),case_type varchar2(20),case_location varchar2(20),case_way varchar2(20));
![fefde131bb1306d61cd7c609a0a614bf.png](https://img-blog.csdnimg.cn/img_convert/fefde131bb1306d61cd7c609a0a614bf.png)
2.导入数据:
INSERT INTO case_test VALUES ('1', '盗窃案', '台东', '技术开锁');INSERT INTO case_test VALUES ('88', '谋杀案', '台东', '技术开锁');INSERT INTO case_test VALUES ('99', '盗窃案', '江西路', '技术开锁');INSERT INTO case_test VALUE