ЗАПРОС ОБЪЕДИНЕНИЯ СУММ

#sum #union #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'
  

Ответ №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')