hive notin
时间: 2023-10-18 12:30:04 浏览: 99
Hive SQL练习题库
在Hive中,not in语法是支持的,但是不支持在where子句中直接使用子查询。如果要实现带有子查询的not in功能,可以借助左关联。例如,可以使用左外连接将两个表连接起来,然后通过判断右表中的值是否为空来实现not in的效果。
例如,可以使用以下语句实现not in的效果:
SELECT skim.userId, skim.itemId
FROM skim
LEFT OUTER JOIN buy ON skim.userId=buy.userId AND skim.itemId=buy.itemId
WHERE buy.userId IS NULL;<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Hive on Spark EXPLAIN statement](https://download.csdn.net/download/weixin_46206568/12274843)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Hive中not in的正确使用](https://blog.csdn.net/weixin_42011858/article/details/125778167)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [hive中使用not in的方法](https://blog.csdn.net/chenyuexing0822/article/details/78525383)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文