Answers.Body: <p>While a code-level fix is obviously preferable, the quick solution is to create two groups:</p>
  
  <ul>
  <li>Everyone who attended the event who has the tag.</li>
  <li>Everyone who attended the event.</li>
  </ul>
  
  <p>Then use the custom search <strong>Include/Exclude by Group/Tag</strong> to include group 2 and exclude group 1.  Who's left is everyone who attended without the tag.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T20:09:42.510Z
Answers.Text: Thanks Jon! That worked for me - had to make yet another group so I could display the results to my liking.
Answers.UserDisplayName: themak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T16:39:44.750Z
Answers.LastActivityDate: 2018-04-27T16:39:44.750Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Thank you for your question that allowed me to test Jon's solution and now find an alternative solution that seems to me even simpler:</p>
  <p>The new SearchKit allows you to do what you want easily.
  The simplest is to choose &quot;Without&quot; from the first drop-down menu and &quot;Tag&quot; from the second drop-down menu.
  Then we can combine tags to different criteria, like Individual. However, I did not test with events.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-25T21:07:58.080Z
Answers.Text: I agree that this is the preferred solution in 2024.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-25T20:59:29.357Z
Answers.LastActivityDate: 2024-03-25T20:59:29.357Z
Answers.UserDisplayName: Alain Rihs
Body: <p>I need to find all contacts that are in our system without a tag AND are Individuals AND registered for a specific event.</p>
  
  <p>This is what I am doing:</p>
  
  <ul>
  <li>Contact -> Contact Type = Individual</li>
  <li>Participant -> Event Title =  Event Name</li>
  <li>Contacts -> Tags = Is Empty</li>
  </ul>
  
  <p>Then I error out - the issue is with the tags - even if I choose <em>Is Null</em> - I still get a ton of errors.  If I chose Contacts -> Tags -> Not In -> Select every tag.  I still get a ton of errors.</p>
  
  <p>PS: Is there a way to use search builder to find an event by Event ID instead of title?</p>
  
  <p>CiviCRM 5.0.2 and Drupal 7</p>
  
  <p>DB Error: No Such Field - Backtrace below.</p>
  
  <hr>
  
  <pre><code>    #0 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(190): CRM_Core_Error::backtrace()
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
  #3 /home/webname/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error-&gt;__construct("DB Error: no such field", -19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #4 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error-&gt;__construct(-19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #5 [internal function](): PEAR-&gt;_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
  #6 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
  #7 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR-&gt;__call("raiseError", (Array:7))
  #8 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR-&gt;raiseError(NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
  #9 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common-&gt;raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'civicrm_tag.name' in 'field list'")
  #10 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli-&gt;mysqliRaiseError()
  #11 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli-&gt;simpleQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #12 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common-&gt;query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #13 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject-&gt;_query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #14 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(392): DB_DataObject-&gt;query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #15 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO-&gt;query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", TRUE)
  #16 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4942): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #17 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Selector.php(1181): CRM_Contact_BAO_Query-&gt;searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE)
  #18 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(108): CRM_Contact_Selector-&gt;alphabetQuery()
  #19 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(136): CRM_Utils_PagerAToZ::getDynamicCharacters(Object(CRM_Contact_Selector), FALSE)
  #20 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(52): CRM_Utils_PagerAToZ::createLinks(Object(CRM_Contact_Selector), NULL, FALSE)
  #21 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search.php(839): CRM_Utils_PagerAToZ::getAToZBar(Object(CRM_Contact_Selector), NULL)
  #22 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search/Builder.php(414): CRM_Contact_Form_Search-&gt;postProcess()
  #23 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Contact_Form_Search_Builder-&gt;postProcess()
  #24 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Refresh.php(75): CRM_Core_Form-&gt;mainProcess()
  #25 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh-&gt;perform(Object(CRM_Contact_Form_Search_Builder), "refresh")
  #26 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Contact_Form_Search_Builder), "refresh")
  #27 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("refresh")
  #28 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller-&gt;run((Array:4), (Array:0))
  #29 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #30 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
  #31 /home/webname/www/www/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:4))
  #32 [internal function](): civicrm_invoke("contact", "search", "builder")
  #33 /home/webname/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
  #34 /home/webname/www/www/index.php(21): menu_execute_active_handler()
  #35 {main}
  </code></pre>
  
Tags: <tags><search-builder>
Title: How to search for all contacts without a tag? Registered for event
ThreadText: # How to search for all contacts without a tag? Registered for event
  
  (Asked by: username_0 on 2018-04-27)
  
  I need to find all contacts that are in our system without a tag AND are Individuals AND registered for a specific event.
  This is what I am doing:
  
  Contact -> Contact Type = Individual
  Participant -> Event Title =  Event Name
  Contacts -> Tags = Is Empty
  
  Then I error out - the issue is with the tags - even if I choose Is Null - I still get a ton of errors.  If I chose Contacts -> Tags -> Not In -> Select every tag.  I still get a ton of errors.
  PS: Is there a way to use search builder to find an event by Event ID instead of title?
  CiviCRM 5.0.2 and Drupal 7
  DB Error: No Such Field - Backtrace below.
  
      #0 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(190): CRM_Core_Error::backtrace()
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
  #3 /home/webname/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #4 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
  #6 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
  #7 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
  #8 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
  #9 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'civicrm_tag.name' in 'field list'")
  #10 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
  #11 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #12 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #13 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #14 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(392): DB_DataObject->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #15 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", TRUE)
  #16 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4942): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
  #17 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Selector.php(1181): CRM_Contact_BAO_Query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE)
  #18 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(108): CRM_Contact_Selector->alphabetQuery()
  #19 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(136): CRM_Utils_PagerAToZ::getDynamicCharacters(Object(CRM_Contact_Selector), FALSE)
  #20 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(52): CRM_Utils_PagerAToZ::createLinks(Object(CRM_Contact_Selector), NULL, FALSE)
  #21 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search.php(839): CRM_Utils_PagerAToZ::getAToZBar(Object(CRM_Contact_Selector), NULL)
  #22 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search/Builder.php(414): CRM_Contact_Form_Search->postProcess()
  #23 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Contact_Form_Search_Builder->postProcess()
  #24 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Refresh.php(75): CRM_Core_Form->mainProcess()
  #25 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Contact_Form_Search_Builder), "refresh")
  #26 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Search_Builder), "refresh")
  #27 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("refresh")
  #28 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller->run((Array:4), (Array:0))
  #29 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #30 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
  #31 /home/webname/www/www/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:4))
  #32 [internal function](): civicrm_invoke("contact", "search", "builder")
  #33 /home/webname/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
  #34 /home/webname/www/www/index.php(21): menu_execute_active_handler()
  #35 {main}
  
  **Tags:** tags, search-builder
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-04-27. Score: 5 | Accepted answer
  
  While a code-level fix is obviously preferable, the quick solution is to create two groups:
  
  * Everyone who attended the event who has the tag.
  * Everyone who attended the event.
  
  Then use the custom search **Include/Exclude by Group/Tag** to include group 2 and exclude group 1. Who's left is everyone who attended without the tag.
  
  > **Comments:**
  > **username_0**: Thanks Jon! That worked for me - had to make yet another group so I could display the results to my liking.  
  
  ---
  
  ### Answer by username_2 on 2024-03-25. Score: 2
  
  Thank you for your question that allowed me to test Jon's solution and now find an alternative solution that seems to me even simpler:
  
  The new SearchKit allows you to do what you want easily.
  The simplest is to choose "Without" from the first drop-down menu and "Tag" from the second drop-down menu.
  Then we can combine tags to different criteria, like Individual. However, I did not test with events.
  
  > **Comments:**
  > **username_1**: I agree that this is the preferred solution in 2024.  
  
  ---
  
  