我使用以下命令从蜂巢中获取最近3个月的数据。
从xyz中选择*其中creat_ts介于' 2017-01-06 00:00:00'和' 2017-03-06 23:59:59';
如何在hive中获取最近3个月的数据而不使用关键字。
答案 0 :(得分:0)
如果您的creat_ts
类型的列timestamp
可以编写您的查询,例如
select * from xyz where from_unixtime(creat_ts) > '2017-01-05' and from_unixtime(creat_ts) < '2017-03-07';
或如果列类型为datetime
或date
,那么您的查询就是
select * from xyz where creat_ts > '2017-01-05' and creat_ts < '2017-03-07';
希望这会有所帮助