HIVE SQL Subquery in WHERE Clause

2019-04-28 13:13发布

I have two tables with similar fields but the query is failing when I am doing a SELECT subquery in a WHERE clause.

SELECT foo 
FROM   bar
WHERE  fizz IN (SELECT fizz FROM fuzz)

I deleted the error.log from AWS but the error was something to the extent that HIVE did not recognize the SELECT.

How do I need to restructure this query?

Thanks.

标签: sql hive
3条回答
男人必须洒脱
2楼-- · 2019-04-28 13:53

From the Subqueries in the WHERE Clause section of the HIVE Language Manual:

SELECT b.foo FROM bar b WHERE b.fizz IN (SELECT f.fizz FROM fuzz f)
查看更多
做自己的国王
3楼-- · 2019-04-28 14:10

Hive does not support IN, EXISTS or subqueries in the WHERE clause. Go for a cross join...

查看更多
Melony?
4楼-- · 2019-04-28 14:11

Hive has problems with subquery in the WHERE clause use a JOIN

SELECT foo FROM bar 
JOIN fuzz
ON bar.fizz=fuzz.fizz
查看更多
登录 后发表回答