MySQL查询:
select * from user_balance_table a where report_date < 20130901 and a.user_id not in (select user_id from user_balance_table a where report_date <20130801);
如何在hive中编写相同的查询?
答案 0 :(得分:0)
select a.*
from
(select * from user_balance_table
where report_date < 20130901
) a
left outer join
(select user_id
from user_balance_table
where report_date <20130801
group by user_id
) b
on a.user_id=b.user_id and b.user_id is null;