天天看點

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就是排序的順序,這個還是挺好用的。