天天看点

oracle 如何按照in排序

[b]1.前言[/b]

in排序有时候还是有必要的。

[b]2.代码[/b]

select b

from a

where b in (440400,440500,440000,440600,440100)

order by case b

when '440100' then

1

when '440400' then

2

when '440500' then

3

when '440600' then

4

when '440000' then

5

end

其中b为要排序的字段,case中的1,2,3,4,5就是排序的顺序,这个还是挺好用的。