首页 > 解决方案 > 从 HIVE 中的列中查找最大值

问题描述

我对 HIVE 非常陌生。我正在使用 QLiksense 和 HIVE。我有一张桌子,上面有年、月、日。我加载了表格并连接为,

Load year&''&month''&day as concatdate;
SQL select * from HIVE. 'abc'. 'def'; 

Load ...
..
(the other fields)
..
..
SQL select * from HIVE. 'abc'. 'def';

现在我想找到最大的 concatdate 并在 HIVE 中单独检索这些行。年月日为字符串类型。

请帮忙。

标签: sqlhiveqliksense

解决方案


一种方法使用子查询:

select h.*
from hive.abc.def h
where h.concatdate = (select max(h2.concatdate) from hive.abc.def h2);

推荐阅读