Answers.Body: <p>Search Builder is more 'raw' and I find end-users are best to avoid it!</p>
  
  <p><code>Search &gt; Custom Searches &gt; Include / Exclude Search</code> will do what you want.</p>
  
  <p>Once you have the results you could save it as a smart group for future use.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-13T10:40:30.683Z
Answers.Text: Aha - great to know! This is a very helpful solution. Thanks!
Answers.UserDisplayName: Andyg8
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-11T12:28:11.590Z
Answers.Text: In 2023 - use SearchKit!
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-11T20:54:05.600Z
Answers.LastActivityDate: 2017-04-11T20:54:05.600Z
Answers.UserDisplayName: Aidan
Body: <p>In Search Builder, if I search for contacts with a particular tag then the output returns the contacts with that tag. </p>
  
  <p>If I then invert the search using 'Not In' or 'Not equals' it shows all the contacts who don't have that contact, but only <strong>from the overall set of contacts who actually have a tag</strong>. In other words, instead of searching the entire database for contacts who do not have that tag, it only searches all the contacts who have tags, and who in addition don't have that tag. </p>
  
  <p>I believe the same applies to Groups.</p>
  
  <p>This is very unintuitive behaviour; one would expect 'not in' or 'not equal' to apply to the entire database since everything else on all search screens does.</p>
  
  <p>In fact, my SQL friends tell me that this is standard behaviour for searches across related tables; you should append an 'Or Null' query to any such searches if you want results returned from the entire database. </p>
  
  <p>However, this would be too much for our non technical admin users to comprehend! Yet they regularly want to find people who don't have one particular tag or aren't in one particular group. </p>
  
  <p>Is there a work around so that 'Not' searches of tags or groups can nevertheless search the entire database?</p>
  
  <p>We're using 4.6.24 and Drupal 7.54. I'm hopeful of a clever work around to this! Thanks for your thoughts.</p>
  
Tags: <search-builder>
Title: Search builder: searching for Not equals or Not In with tags or groups doesn't include Null
ThreadText: # Search builder: searching for Not equals or Not In with tags or groups doesn't include Null
  
  (Asked by: username_0 on 2017-04-11)
  
  In Search Builder, if I search for contacts with a particular tag then the output returns the contacts with that tag.
  
  If I then invert the search using 'Not In' or 'Not equals' it shows all the contacts who don't have that contact, but only **from the overall set of contacts who actually have a tag**. In other words, instead of searching the entire database for contacts who do not have that tag, it only searches all the contacts who have tags, and who in addition don't have that tag.
  
  I believe the same applies to Groups.
  
  This is very unintuitive behaviour; one would expect 'not in' or 'not equal' to apply to the entire database since everything else on all search screens does.
  
  In fact, my SQL friends tell me that this is standard behaviour for searches across related tables; you should append an 'Or Null' query to any such searches if you want results returned from the entire database.
  
  However, this would be too much for our non technical admin users to comprehend! Yet they regularly want to find people who don't have one particular tag or aren't in one particular group.
  
  Is there a work around so that 'Not' searches of tags or groups can nevertheless search the entire database?
  
  We're using 4.6.24 and Drupal 7.54. I'm hopeful of a clever work around to this! Thanks for your thoughts.
  
  **Tags:** search-builder
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-11. Score: 3 | Accepted answer
  
  Search Builder is more 'raw' and I find end-users are best to avoid it!
  
  `Search > Custom Searches > Include / Exclude Search` will do what you want.
  
  Once you have the results you could save it as a smart group for future use.
  
  > **Comments:**
  > **username_0**: Aha - great to know! This is a very helpful solution. Thanks!  
  > **username_1**: In 2023 - use SearchKit!  
  
  ---
  
  