Fixed the simple query above.
Thank you for the response, that’s helpful. And you’re right, indeed, that block gets returned, which I hadn’t noticed.
But that makes me realize I oversimplified my question. This query gives me a list of all the TODO blocks tagged with #inbox:
#+BEGIN_QUERY
:query (and (task TODO) [[inbox]])
#+END_QUERY
However, I want to further filter this and only display the TODO blocks that 1) have a schedule associated with them, and 2) are scheduled for today or earlier.
I’m finding no way to do this with :query. When I used the advanced query below instead:
#+BEGIN_QUERY
{ :query [:find (pull ?b [* {:block/_parent ...}])
:in $ ?date ?tag
:where [?b :block/scheduled ?day]
[(<= ?day ?date)]
[?p :block/name ?tag]
[?b :block/refs ?p]
[?b :block/marker ?marker]
[(contains? #{"TODO"} ?marker)]
[?b :block/content ?desc]]
:inputs [:today "inbox"]
}
#+END_QUERY
…it leaves out the block I mentioned above (where the TODO block is a child of the #inbox tag).
EDIT: Addressed in SCHEDULED tasks with a tag in the parent