Query all tasks related to one common tag

Here is my pages:
image
image
Both people and project are linked to one tag work.

I would like to gather all tasks from work tag.
So I write my journal like this:


and then simple query like this works good
{{query (and (task doing todo) [[work]] )}}

I want to avoid adding all tasks in journal under work tag and write tasks just on first level:


and then I would like to query all tasks which related to work but not directly.
How can I do it?

This seems similar, but I would like to query it not only on work page itself, but everywhere.
Thank you.

Hello! I have made an advanced query for you to accomplish just that!

#+BEGIN_QUERY
{:title "Work tasks"
 :query [:find (pull ?b [*])
   :where
     [?t :block/name "work"] ; always lowercase
     [?p :block/tags ?t]
     [?b :block/refs ?p]
     [?b :block/marker ?m]
     [(contains? #{"TODO" "DOING"} ?m)]
 ]
}
#+END_QUERY

I will also link this in the task management topic :slight_smile:

1 Like

@Siferiax this is awesome :tada:
Exactly what I looked for :bowing_man:
Thank you!