ORACLE sql 排序 根据两个条件排序,如图,根据日期由小到大排序,同时BRAND字段柳汽的排前面,怎么写?
发布网友
发布时间:2022-05-23 14:03
我来回答
共3个回答
热心网友
时间:2023-10-24 02:35
要排序的字段用逗号隔开:
select * from 表名 order by BUY_DATE,BRAND
热心网友
时间:2023-10-24 02:36
(select * from table_name where brand='柳汽' order by buy_date)
union all
(select * from table_name where brand<>'柳汽' order by buy_date)
;
热心网友
时间:2023-10-24 02:36
select * from 表名
order by case when brand='柳汽' then 0 else 1 end,buy_date desc