美文网首页
hive semi and having 例子

hive semi and having 例子

作者: 485b1aca799e | 来源:发表于2017-06-17 23:58 被阅读0次
  • 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);

相关文章

网友评论

      本文标题:hive semi and having 例子

      本文链接:https://www.haomeiwen.com/subject/ciabqxtx.html