我正在尝试在我的Google表格中创建一个简单的查询,该查询允许我标记它输出的两列,并根据另一列对结果进行排序。但是,只要我添加Order By或第二个Label命令,它就会抛出并出错。这是我的公式。谢谢你的帮助。
=query(A1:H,"SELECT H, SUM(G) WHERE H > '' AND G > 0 GROUP BY H ORDER BY A LABEL SUM(G) 'Sub Total', LABEL H 'Group Description'",0)
答案 0 :(得分:6)
试试这个。如果需要,可以隐藏A列的查询返回。另请注意标签语法。
if ((finalDate.compareTo(VolleyURL.getDateNumber())!=0)) {
Log.d(TAG, "===TRUE====: ");
getmOpenWeatherMapListto.add(openWeatherMapDaysTo.getList().get(j));
Log.d(TAG, "openWeatherDaysTo SIZE ===> " + getmOpenWeatherMapListto.size());
mForecastAdapters = new ForecastAdapters(getApplicationContext(), getmOpenWeatherMapListto);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mForecastAdapters);
mForecastAdapters.notifyDataSetChanged();
// break out of the for loop here otherwise your adapter will be created
// again and set to your recyclerview
break;
}
以下是我的测试电子表格:https://docs.google.com/spreadsheets/d/1U6OFD_bxkNu27WMFPYHcxps1SA3oH9m3jMTEdb-fiQY/edit?usp=sharing
答案 1 :(得分:0)
查询中存在多个问题。首先,删除LABEL的第二次出现。其次,应该颠倒数据表(和查询字符串)中的列H和G的顺序。聚合器(你所分组的库)应位于左侧。