Filter main query based on results of nested query

Say, I have “posts” and “comments”.
Thanks to the Nested Queries now I can get all posts and all of comments for each post in one query. I can even filter “comments” query however I want.

But what if I also want to filter posts by the presence of specific comments? For example, get all posts that have comments that were made today.
Basically, I just need to exclude all the posts in the query that didn’t get any comments.

how did you go about handling this need?

So, I have ‘transactions’ and ‘parts’. Every transaction can have multiple parts.

  1. Make a part_array with conditions that I need.


    image
    Use sum(‘id’) aggregation to avoid doubles. (it doesn’t matter if it sum or count or etc)

  2. Then we just have to make simple array from this.
    Make a variable, like transaction_filter_array with the formula part_array.join(",","transaction_id").split(",")
    (maybe you can do this simpler now with new Arrays component)

  3. And then I just use condition “in” to filter only transactions that in this array.