联盟都没有工作

时间:2017-11-27 17:52:45

标签: sql hive union-all

我试图总结Hive中2个内部查询的计数,但这会引发错误“UDAF计数尚未支持的位置”。任何建议都会很棒

SELECT sum(count(distinct session),count(distinct session1)) FROM (
select concat(high, low, visit_num) as session from tab1
union all
select concat(high, low, visit_num) as session1 from tab2)t;

1 个答案:

答案 0 :(得分:3)

SELECT sum(cnt) 
FROM 
(
  select count(distinct concat(high, low, visit_num)) as cnt from tab1
  union all
  select count(distinct concat(high, low, visit_num)) as cnt from tab2
) t