Search code examples
google-sheetsgoogle-query-language

How do I write a query that combines two numbers that are being separated from another query?


I am trying to use this code to return values from a certain date

=query(Overview!A:G,"select B where A = date '" & text(B2, "yyyy-MM-dd") & "'")

The problem is that on the other sheet I'm querying from multiple sheets and then the query above is separating the value into the values from all the original sheets. It looks like this:

Followers

How do I write the query so it combines the 1 with the 154280 from the other sheet.

By "it combines", I mean aggregate SUM. The number is aggregate the sum in the master sheet, but it's separating out once I rerun a new query over the other query.


Solution

  • Use the aggregation function SUM:

    =query(Overview!A:G,"select SUM(B) where A = date '" & text(B2, "yyyy-MM-dd") & "'")
    

    Reference