• oracle表的列合并(group by)和行合并(union all)


    
    

    group by

    select a.dn,t.dn dnt,a.BEGIN_TIME,a.R032_001,t.R032_001,a.R032_002,a.R032_003,a.R032_004,
    a.R032_005,t.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,t.R032_009,a.R032_019,t.R032_019
      from PM_LTE_CELL_3 a, PM_LTE_CELL_3CDLOBAK t
     where a.dn = t.dn
       and a.begin_time = t.begin_time
       and t.begin_time =
           to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')
       and t.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1';

    结果只有1行,但列数多了:

    union all

    select a.dn,a.BEGIN_TIME,a.R032_001,a.R032_002,a.R032_003,a.R032_004,a.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,a.R032_019
      from PM_LTE_CELL_3 a
     where a.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1'
       and a.begin_time =
           to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')
     UNION ALL
      select a.dn,a.BEGIN_TIME,a.R032_001,a.R032_002,a.R032_003,a.R032_004,a.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,a.R032_019
              from PM_LTE_CELL_3CDLOBAK a
             where a.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1'
               and a.begin_time =
                   to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')
    

      结果有两行,列数没变:

  • 相关阅读:
    mybatis
    spring mvc
    Spring Boot2
    Spring AOP
    Spring Boot1
    Spring IOC
    Multiple_LinearRegression_Test2
    Multiple_LinearRegression_Test
    Simple_LinearRegression_Test
    写决策树时遇到的坑
  • 原文地址:https://www.cnblogs.com/wangziyi0513/p/11209164.html
Copyright © 2020-2023  润新知