# Logseq Advanced Queries
## Getting Unscheduled or Tasks that are Scheduled in the Past
```
#+BEGIN_QUERY
{
:title ["Tasks"]
:query [
:find (pull ?b [*])
:in $ ?queryPage ?today
:where
(task ?b #{"NOW" "LATER"})
[?p :block/name ?queryPage]
[?p :block/alias ?alias]
(or
[?b :block/path-refs ?p]
[?b :block/path-refs ?alias]
)
(or-join [?b ?today] ;Using ?b and ?today
(not [?b :block/scheduled ?d])
(and
[?b :block/scheduled ?d]
[(<= ?d ?today)])
)
]
:inputs [:query-page :today]
:breadcrumb-show? true
}
#+END_QUERY
```