hive不支持select select子查询
形如这样的查询hive不支持:
SELECT loan_number
,(SELECT count(*) FROM inq_back WHERE loan_number = ib.loan_number AND to_date(INQUIRY_DATE,'yyyy-mm-dd') >= (funding_success_date - 7)) AS iqr_tt_7d
,(SELECT count(*) FROM inq_back WHERE loan_number = ib.loan_number AND to_date(INQUIRY_DATE,'yyyy-mm-dd') >= (funding_success_date - 14)) AS iqr_tt_14d
FROM (SELECT DISTINCT loan_number FROM inq_back) ib
由于不支持该写法,我用的办法是groupby,然后再按照链接key join
留言
張貼留言