sql - 从 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 中单独检索这些行。年月日为字符串类型。
请帮忙。
解决方案
一种方法使用子查询:
select h.*
from hive.abc.def h
where h.concatdate = (select max(h2.concatdate) from hive.abc.def h2);
推荐阅读
- python - 在 python 项目的不同依赖项的环境之间自动切换
- angular - 如何使用 Webpack 5 编码拆分 Angular 11
- javascript - 不能在 vue 组件中包含高位图表
- mysql - MySQL 已安装,但在 MacOS Mojave 上找不到
- c# - 串口IO异常
- angular - 在angular2中导入openpgp
- html - 使 bg 图像全宽并滚动以查看图像的其余部分
- python-3.x - Python CV2按键响应时间慢
- javascript - 一键打开 Bootstrap 模型并加载加载 iframe
- swift - 如何让用户添加自定义注释?