不在Hive QL中

时间:2013-01-08 21:27:32

标签: sql hive

我正在将SQL Server存储过程转换为HiveQL。

我如何转换如下内容:

SELECT * FROM table1 WHERE id NOT IN (7,6,5,4,2,12)

3 个答案:

答案 0 :(得分:5)

答案 1 :(得分:1)

试试这个:

SELECT * FROM table1 WHERE NOT array_contains(array(7,6,5,4,2,12), id)

答案 2 :(得分:-4)

根据documentation,它说您可以使用not in

否定的表格可以写成如下:

from DomesticCat cat where cat.name not between 'A' and 'B'

from DomesticCat cat where cat.name not in ( 'Foo', 'Bar', 'Baz' )

在问题中尝试查询时是否收到错误?

请根据参考资料尝试。

相关问题