本帖最后由 u011820742 于 2013-12-04 09:44:19 编辑

解决方案 »

  1.   


    Select A,case when 序号=1 then 1 
    when 序号=2 then 2
    when 序号=6 then 3
    when 序号=4 then 4
    when 序号=5 then 5
    else 999
    end as px
    from 表B where 序号 in(1,2,6,4,5)
    order by px
    要是动态的就循环拼串吧。
      

  2.   

    Select A from 表B where 序号='1'
    union all
    Select A from 表B where 序号='2'
    ...这样一定是按照你的顺序来显示的,不过这样有什么意义么?
      

  3.   

    Select A from 表B where 序号 in(1,2,6,4,5) 
    order by decode(序号,1,1,2,2,6,3,4,4,5,5)
      

  4.   

    在where条件后面用order by 语句,有什么不妥吗?
      

  5.   


    Order by 只是根据序号的大小进行 顺序或倒叙的排列Select A from 表B where 序号 in(1,2,6,4,5) 我让6序号的记录 排列在4 和 5前面  所以实现不了 
      

  6.   

     Select * from A where 序号 in(1,2,6,4,5)) ORDER BY INSTR(1,2,6,4,5,序号) 
    用INSTR函数  找到了 同样谢谢各位回答 
      

  7.   


    Order by 只是根据序号的大小进行 顺序或倒叙的排列Select A from 表B where 序号 in(1,2,6,4,5) 我让6序号的记录 排列在4 和 5前面  所以实现不了 
    明白了,这是需求的要求
      

  8.   

    我感觉可以先对其进行加编号,在编号的降序查询:
    select B.列名 from A(select C.*,C rn from A c)order by decode C.row;
      

  9.   

    上面的语句有点错误,模拟了下:
    select * from (select a.*,rownum rn from users a )  order by  rn asc
    结果: