有个表 有数据
列1         列2(时间列)
A           2010-06-01
B           2010-06-01
C           2010-06-02
D           2010-06-02
怎样才能使他变成下面这样
列1   列2     列3(时间列)
A     B      2010-06-01
C     D      2010-06-02

解决方案 »

  1.   

    确定每个日期只有2行妈
    select  min(列1),max(列1),列2
    from t
    group by 列2如果有多行,只能用行转列了
      

  2.   


    select regexp_substr(col1,'[^,]+',1,1) as 列1,
           regexp_substr(col1,'[^,]+',1,2) as 列2,
           col2 as 列3
      from(select wm_concat(列1) as col1,列2 as col2
             from table_name
           group by 列2) t1;
      

  3.   

    select col2, wm_concat(col1)
      from (select 'a' as col1, '2010-06-01' as col2
              from dual
            union all
            select 'b' as col1, '2010-06-01' as col2
              from dual
            union all
            select 'c' as col1, '2010-06-02' as col2
              from dual
            union all
            select 'd' as col1, '2010-06-02' as col2 from dual)
     group by col2
    将就着用吧 哈哈