select * from test order by decode(ID,'a',1,'b',2,'c',3,4);
select * from test order by (case ID when 'a' then 1 when 'b' then 2 when 'c' then 3 else 4 end);
如果你是想按记录在数据表中的物理顺序排序:select * from test order by rowid
如果你是想按查询条件的先后排序:
select *, 1 as ordidx from test where name = 'b'
union all
select *, 2 as ordidx from test where name = 'a'
union all
select *, 3 as ordidx from test where name = 'c'
order by ordidx