Thanks Shaofeng! May u give some hints on how to do this? Thanks again! Best, Feng.
发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用 ________________________________ 发件人: ShaoFeng Shi <[email protected]> 发送时间: Friday, September 28, 2018 10:45:12 PM 收件人: user 主题: Re: Sorting and aggregating at the same time Hi Feng, Hmm... it is doable I think, but not a common case. Francis Liang <[email protected]<mailto:[email protected]>> 于2018年9月28日周五 下午5:50写道: Hi guys: As all know, TOP_N expression can be used in the following scenario: Select dim_a, sum(metric_a) sum_metric_a from table group by dim_a order by sum_metric_a desc limit 100 However, can we sort one metric but aggregate other metrics at the same time, like the following scenario: Select dim_a, sum(metric_a) sum_metric_a, sum(metric_b) sum_metric_b, sum(metric_c) sum_metric_c from table group by dim_a order by sum_metric_a desc limit 100 Of course it can be done by just using the normal expression and sort it online during query process, but can it be done as a pre-calculation, just like the TOP_N? Hope this makes sense. Thanks guys! Best, Feng 发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用 -- Best regards, Shaofeng Shi 史少锋
