- hive中l(wèi)eft semi join相當(dāng)于SQL中的where in語句
- having語句用于在group by中對(duì)每組數(shù)據(jù)進(jìn)行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);