SELECT * FROM T_1
  where c=0 ORDER BY b
union
SELECT * FROM T_1
  where c=0 ORDER BY b desc;

解决方案 »

  1.   

    SELECT * FROM T_1
      where c=0 ORDER BY b
    union
    SELECT * FROM T_1
      where c=1 ORDER BY b desc;
      

  2.   

    select * from (select b,c from t_1 where c=0 order by b)
    union all
    select * from (select b,c from t_1 where c=1 order by b desc);
      

  3.   

    以上的诸位朋友,先谢谢了.但是很不幸.
    你们给的SQL都不能正常执行.
    f_ky(毛蛋哥哥)  和 tomhuang(春城)   ORA-00933
    zhaoyongzhu(zhaoyongzhu)  ORA-00907
    上面是你们对应的错误码.
    我用的是ORACLE8.05.是不是和这个有关系呢?
      

  4.   

    我的sql语句在8.1.7中测试过了,没有问题的。
    8.0.5版本的oracle不支持在子查询中order by。恐怕你比较麻烦。
      

  5.   

    select b,c from aa order by decode(c,0,b,9999999 - b);
    注意:其中的9999999是一个比较大的数,总之不能小于 b 的最大值,如果类型是不是数值型,只需做小小的改动即可。
      

  6.   

    select b,c from T_1 order by decode(c,0,b,9999999 - b);
      

  7.   

    对qiuyang_wang(小数点) 佩服的五体投地