How to combine a sum value from one query with another query

Hey all,

For some reason struggling with this one.

This is the scenario:
I need to sum the value of a field in a Multiple Records query (query1)
I need to sum the value of a field in a Multiple Records query (query2)
I then want to add both of those values into one value. So query1.sum(field1 * field2) + query2.sum(field1 * field2)

Both queries query the same table. But, I have another field I’ve been trying to use a where condition of either 1 or 2 to get the different results for query1 and query2, which isn’t working.

Seems simple enough, but I just can’t get it to work.

I’m ending up having to create a query for each condition (1 or 2). Then repeat on that query with a setValue to create the output per row. On the front end I then sum the array on that setValue output.

But I still can’t combine.

I’m certain this should be simple. Perhaps this is one of those requirements of MySql views? I’m just not familiar and from what I understand these still are not supported.

Any help appreciated.

Community Page
Last updated: