hive semi and having 例子

  • hive中left semi join相当于SQL中的where in语句
  • having语句用于在group by中对每组数据进行where条件限制
select * from user_action_201704 y 
left semi join 
(select userid as xuserid,count(*) as count 
from user_action_201704 
where day="04" 
and city="5000" 
group by userid 
having count(*)<= 6 ) x 
on y.userid=x.xuserid 
where y.day="04" 
order by y.userid,substring(y.action,1,20);
    原文作者:守护者20091776
    原文地址: https://www.jianshu.com/p/f384a4aab466
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞