Advance query excluding a tag

Hi folks,
I have this query ↴

#+BEGIN_QUERY
{:title [:h3 "→ Follow-Up NOW"]
:query [:find (pull ?b [*])
    :in $ ?current-page ?today
    :where
    [?p :block/name ?current-page]
    [?b :block/refs ?p]
     (or-join [?b ?today] ; so or-join and bind both ?b and ?today
       (and 
         [?b :block/scheduled ?d]
         [(<= ?d ?today)]
       )
   (not [?b :block/scheduled])
   (not [?b :block/path-refs [:block/name "nf"]])
)
    (task ?b #{"IN-PROGRESS", "WAITING" "DOING" "NOW" "TODO" "LATER"})
]
:inputs [:current-page :today]
:breadcrumb-show? true
:group-by-page? true
:collapsed? false
}
#+END_QUERY

The problem is that the tasks with the tag #nf remain in my results.
How can I exlclude the tag?

They remain in your results, because the condition (not [?b :block/path-refs [:block/name "nf"]]) is inside or-join . Check if the parentheses are as you mean them to be. If you cannot tell, describe what you are trying to achieve (preferably with examples), for us to see if this query fits your description or what is going on.

I want to get the same result that I have without the line (not [?b :block/path-refs [:block/name "nf"]]) and then exclude the results that contains the tag “nf”

Try moving that outside the parenthesis, like this:

#+BEGIN_QUERY
{:title [:h3 "→ Follow-Up NOW"]
:query [:find (pull ?b [*])
  :in $ ?current-page ?today
  :where
    [?p :block/name ?current-page]
    [?b :block/refs ?p]
    (or-join [?b ?today] ; so or-join and bind both ?b and ?today
      (and 
        [?b :block/scheduled ?d]
        [(<= ?d ?today)]
      )
      (not [?b :block/scheduled])
    )
    (not [?b :block/path-refs [:block/name "nf"]])
    (task ?b #{"IN-PROGRESS", "WAITING" "DOING" "NOW" "TODO" "LATER"})
  ]
:inputs [:current-page :today]
:breadcrumb-show? true
:group-by-page? true
:collapsed? false
}
#+END_QUERY

Super!!
Thank you very much :smiley: