HIVE查询:
SELECT order_cnt, COUNT(user_id), COUNT(DISTINCT user_id)
FROM (
SELECT *
FROM daojia_ml.sy_codesubsidy_discount_info
WHERE dt = '2018-09-03'
)
GROUP BY order_cnt;
报错:FAILED: ParseException line 10:7 missing EOF at 'by' near 'group'
原因:hive本身缺陷,需要在每个子查询后面加别名。
SELECT order_cnt, COUNT(user_id), COUNT(DISTINCT user_id)
FROM (
SELECT *
FROM daojia_ml.sy_codesubsidy_discount_info
WHERE dt = '2018-09-03'
) a
GROUP BY order_cnt;