我正在编写一个查询,它需要按行的类型进行分组,并将值除以总数,以了解impala中total的百分比。前任。:
Name performance
something type1 something 15
something type1 something 18
something type2 something 23
something something something 345
something type2 something 23
SELECT
CASE WHEN name like '%type1%' then 'type 1'
WHEN name like '%type2%' then 'type2'
ELSE 'other' END as type
,sum(performance) / (SELECT sum(performance) FROM table)
FROM table
GROUP BY type
这给了我一个analysisexception错误:选择列表中不支持子查询。有人能告诉我如何处理这个问题吗?
1条答案
按热度按时间cigdeys31#
我想它只需要“()”