0
点赞
收藏
分享

微信扫一扫

hive中having 后面count(xx) 条件的问题

凯约 2022-11-16 阅读 70


语句1:

select 
user_name
from
user_trade
where
year(dt) = '2018'
group by
user_name
having
count(distinct goods_category) > 2;

会出现错误:

hive中having 后面count(xx) 条件的问题_hive

FAILED: SemanticException [Error 10002]: Line 10:19 Invalid column reference 'goods_category'

如果我们不使用去重的关键字, 就是可以运行的

语句2:

select 
user_name
from
user_trade
where
year(dt) = '2018'
group by
user_name
having
count(goods_category) > 2;

hive中having 后面count(xx) 条件的问题_having_02

 

举报

相关推荐

0 条评论