Help in creating a task query for children blocks under specific parent block

I have a quite similar issue where I have a Journal with a section called “Tasks” and one called “Notes”.

Example:

### **Tasks**
   - TODO Task 1
   - TODO Task 2
### **Notes**
   - Note 1
   - Note 2
     - TODO Something to do
   - Note 3
     - TODO Another thing to do

I need a query which only returns the TODOs nested under the “Notes” section but not the ones under “Tasks”. No matter what I try, I either get all TODOs from all Journals or nothing at all.

I tried to rewrite @mentaloid’s example as follows but get nothing in return:

#+BEGIN_QUERY
{ :inputs [:today]
 :query [:find (pull ?b [*])
   :in $ ?today
   :where
     [?notes :block/original-name "Notes"]
     [?c2 :block/parent ?b]
     [?c2 :block/refs ?notes]
     [?c2 :block/marker ?marker2]
     [(contains? #{"TODO" "LATER"} ?marker2)]
 ]
}
#+END_QUERY

I also tried the example from Queries for task management - Customization / Look what I built - Logseq and changed it to show all from today, which works. But now I also have the tasks from the “Tasks” section, which I dont want.

Now I am out of ideas. Anybody who can guide me in the right direction? :slight_smile: