0
我试图获得阴影区域的不同人数。3个表格的左外连接
表结构如下:
customer key
A234 1
A345 4
A12 5
A989 6
HIVE查询:
select count(distinct(a.customer))
from (
select *
from cust
where key in (1,2,3)) c
left outer join (
select *
from cust
where key in (4,5)) a on a.customer= c.customer where c.customer is null
join
(select *
from cust
where key in (6,7,8,9)) d on c.customer = d.customer and d.customer is null;
错误:
在缺少EOF '加入' 接近 '零'
感谢,在所有三个圆的交叉获取数据,这是编写查询的正确方法: 选择总数(*) (选择c customer from cust c group by c.customer having sum(case case when key in(1,2,3,4,5,6,7,8,9 )then 1 else 0 end)> 0 )c – user3447653
@ user3447653。 。 。是的,那会起作用。 –