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。 。 。是的,那會起作用。 –