我正在蜂巢下面运行查询
SELECT
a.NDC,
a.filetag,
b.filetag AS filetag_RMIID1,
a.medid,
b.MED_REF_FED_LEGEND_IND,
b.MED_MEDID_DESC
FROM
TMPTBL_RMINDC1_MERGED_SORTED_ND a
INNER JOIN TMPTBL_RMIID1_MERGED_SORTED_ND b ON a.medid = b.medid
WHERE
b.filetag = (SELECT MIN(c.filetag) FROM TMPTBL_RMIID1_MERGED_SORTED_ND c WHERE c.medid = a.medid AND c.filetag >= a.filetag)
并出现错误
Error: Error while compiling statement: FAILED: ParseException line
5:19 cannot recognize input near 'SELECT' 'MIN' '(' in expression
specification (state=42000,code=40000)
请帮助我。
答案 0 :(得分:2)
Hive在where子句子查询中仅支持IN/NOT IN, EXISTS/NOT EXISTS
。在您的查询中,将where条件替换为以下内容,它应该可以工作:
b.filetag in (SELECT MIN(c.filetag) FROM TMPTBL_RMIID1_MERGED_SORTED_ND c
WHERE c.medid = a.medid AND c.filetag >= a.filetag)
有关配置单元子查询支持的更多详细信息,可以在这里找到: Hive Subqueries