【问题标题】:SUM UNION QUERY求和查询
【发布时间】:2019-03-04 22:44:58
【问题描述】:

我对 UNION ALL 有以下查询。我只需要对其进行修改,以便对结果求和。

select count (*)
from BAU_DEAN_USER 
where checked_date >= date '2019-03-01' and checked_date < date '2019-03-05'

UNION ALL

select count (*)
from BAU_DEAN_USER_ARCHIVE 
where checked_date >= date '2019-03-01' and
      checked_date < date '2019-03-05'

【问题讨论】:

    标签: sum union union-all


    【解决方案1】:
    select count (*) from 
    (select 'a' from
    BAU_DEAN_USER where checked_date >= date '2019-03-01' and checked_date < date '2019-03-05'
    
    UNION ALL
    
    select 'a' from BAU_DEAN_USER_ARCHIVE where checked_date >= date '2019-03-01' and checked_date < date '2019-03-05')
    

    【讨论】:

      猜你喜欢
      • 2021-10-15
      • 2010-09-09
      • 2013-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多