问题
I'm trying to use multiple where
conditions (2 conditions) with 'group by' and 'order by' statements inside a Google Sheets Query formula.
query(Sites!A:D,"select A,C,sum(D)
where B contains 'Google'
and sum(D) > 100
group by A,C
Order by sum(D) desc label sum(D) 'Total Impressions'")
Above is the formula I tried, but it gives me an error with #VALUE!
Is it an issue with the order of statements?
回答1:
Aggregation functions can be used in select, order by, label, format clauses. They cannot appear in where, group by, pivot, limit, offset, or options clauses.
回答2:
Add a second where should work
query(Sites!A:D,"select A,C,sum(D)
where B contains 'Google'
and where sum(D) > 100
group by A,C
order by sum(D) desc label sum(D) 'Total Impressions'")
来源:https://stackoverflow.com/questions/55481292/google-sheets-query-multiple-where-conditions-with-group-by-and-order-by