------解决方案-------------------- group by ------解决方案-------------------- select * from tb order by decode(type,1), type; ------解决方案-------------------- 用union all
先查询满足条件的,比如
select ...
where type = 1
union all
select ...
where type <> 1 ------解决方案--------------------
正解 ------解决方案--------------------
用decode确实不错
select * from tb order by decode(type,1,1),type ------解决方案-------------------- id不需要排序吗? ------解决方案-------------------- select id,name,type from [tablename] where type=1 union
select id,name,type from [tablename] where type<>1