与Hive中的特定列不同 [英] Distinct on specific column in Hive
本文介绍了与Hive中的特定列不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行Hive 071
我有一个表,有多行,列值相同
例如
I am running Hive 071 I have a table, with mulitple rows, with the same column value e.g.
x | y |
---------
1 | 2 |
1 | 3 |
1 | 4 |
2 | 2 |
3 | 2 |
3 | 1 |
我希望x列具有唯一性,并删除具有相同x val $ b $的行b例如
I want to have the x column unique, and remove rows that have the same x val e.g.
x | y |
---------
1 | 2 |
2 | 2 |
3 | 2 |
或
x | y |
---------
1 | 4 |
2 | 2 |
3 | 1 |
都是很好的
,因为它们的区别仅在于整个蜂巢中的rs, t找到办法做到这一点
are both good as distinct works only on the whole rs in hive, I couldn't find a way to do it
help please
Tx
help please Tx
推荐答案
您可以使用distinct关键字:
You can use the distinct keyword:
SELECT DISTINCT x FROM table
这篇关于与Hive中的特定列不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文