字段
A               B
A1 B1
A2 B2
A3 B3A,B数据变成
A1
B1
A2
B2
A3
B3

解决方案 »

  1.   

    select A from T
    union 
    select B from T
      

  2.   

    select A from T
    union  all
    select B from T 
     
      

  3.   

    union 做不到上面数据结果,做报表用,博计报表
      

  4.   

    --3楼应该是OK的,使用reverse函数排序
    SELECT *
      FROM (SELECT a
              FROM tt
            UNION ALL
            SELECT b FROM tt)
     ORDER BY REVERSE(a);
      

  5.   


    with temp as(
    select 'A1' A,'B1' B from dual
    union all
    select 'A2' A,'B2' B from dual
    union all
    select 'A3' A,'B3' B from dual
    )
    select * from(
    select A from temp
    union all
    select B from temp
    ) order by reverse(a);
      

  6.   

    SQL> select a from T union all select b from T;A
    ----
    A1
    A2
    A3
    B1
    B2
    B3123的排序不是楼主想要的。to--5楼
      

  7.   

    这里只是测试数据,感觉不应该用reverse
    with temp as(
    select 'A1' A,'B1' B from dual
    union all
    select 'A2' A,'B2' B from dual
    union all
    select 'A3' A,'B3' B from dual
    )
    select col from(
    select A col,rownum rn from temp
    union all
    select B col,rownum+0.5 rn from temp
    ) order by rn;
      

  8.   

    轻微变态点 
    要是排列成这样子呢
    B1 A1 B2 A2 B3 A3
      

  9.   


    如果是
    字段
    A B
    A3 B3 
    A2 B2
    A1 B1
    reverse 不能达到要求。还是支持9楼这种变通的方法
      

  10.   

    select 1 seq, A from T
    union  
    select 2 seq, B from T
    order by 2,1;