基于计数平均值的配置单元选择计数

6ojccjat  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(287)

嗨,我正在努力寻找计数,这是高于平均使用以下Hive语句

Select x, Count(x) as y from data  

group by x

Having Count(x) >= (select Avg(z.count1) as aveg 
                    from (select x, Count(x) as count1 from data group by x ) z) ;

我收到错误,因为parseexception行1:87无法识别表达式规范中“select”“avg”()附近的输入

enxuqcxy

enxuqcxy1#

select      x
           ,cnt_x

from       (select      x
                       ,count(x)                as cnt_x
                       ,avg (count(x)) over ()  as avg_cnt_x

            from        data  

            group by    x
            ) t

where       cnt_x >= avg_cnt_x

相关问题