我刚开始查询,不知道如何在两列中获得sum的分组结果。

图片中有两列中的名称和点的数据集和查询公式,用于对前两列的结果进行求和和分组。
=QUERY(AF2:AJ34; "select AG, sum(AH)
where AG is not null
group by AG
order by sum(AH) desc
label AG 'Name', sum(AH) 'Points'")我如何才能得到相同的结果,但从两列点呢?
发布于 2023-04-11 18:55:41
也许您可以通过堆叠这两列:{AG2:AH;AI2:AJ}来创建一个带有花括号的两列范围。
=QUERY({AG2:AH;AI2:AJ}; "select Col1, sum(Col2) where Col1 is not null group by Col1 order by sum(Col2) desc label Col1 'Name', sum(Col2) 'Points'")(PS:您也可以使用VSTACK而不是花括号)
https://webapps.stackexchange.com/questions/170152
复制相似问题