Answers.Body: <p>One way of achieving your goal would be via a temporary group:</p>
  
  <ol>
  <li>Using advanced search, search for all contacts who <em>do</em> have a relationship (simply open the "Relationships" tab, enter nothing, and search - it will default to all active relationships).</li>
  <li>Add all the resulting contacts to a group (or make a smart group if you want to save yourself this step in the future).</li>
  <li>Using search-builder, find all contacts not in that group.</li>
  </ol>
  
  <p>PS: the "Parent" contact sub-type has nothing to do with relationships. Contact types are quite different in CiviCRM from relationships, and having one does not automatically bestow the other.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T14:16:49.773Z
Answers.Text: Sorry it doesn't work unfortunately, Search builder still gives contacts with at least one Relationship.
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T15:37:48.740Z
Answers.Text: Try the include/exclude custom search
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T17:05:39.830Z
Answers.Text: Have tried several conditions, one which did the trick  *once(!)* is " Contact ->Group(s) -> Is null ". Thanks God I've added contacts found in a group than; haven't been able to repeat this  since: "Not in group" gives no results (mean, too much results);  no luck with 'Is null' / '≠' / 'Is empty'  as well. Moreover, it gives "random" results: sometimes it;s an empty set, sometimes it's a couple of records..
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T18:34:03.680Z
Answers.Text: Did you try the include/exclude custom search?
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T19:14:25.730Z
Answers.Text: It took me time to realise what "include/exclude custom search" means and where is it. For those who'd be interested, it's here: /civicrm/contact/search/custom?csid=4&reset=1 And this works, thanks! Wish I found it before.
Answers.UserDisplayName: yurg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-16T20:33:58.553Z
Answers.LastActivityDate: 2015-10-16T20:33:58.553Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>Lots of years after the question was asked, but still a relevant question.</p>
  <p>You can find contacts without relationships using the 'without' join in SearchKit:</p>
  <p>See <a href="https://dmaster.demo.civicrm.org/civicrm/admin/search#/create/Contact?params=%7B%22version%22:4,%22select%22:%5B%22id%22,%22display_name%22%5D,%22orderBy%22:%7B%7D,%22where%22:%5B%5D,%22groupBy%22:%5B%5D,%22join%22:%5B%5B%22Contact%20AS%20Contact_RelationshipCache_Contact_01%22,%22EXCLUDE%22,%22RelationshipCache%22,%5B%22id%22,%22%3D%22,%22Contact_RelationshipCache_Contact_01.far_contact_id%22%5D%5D%5D,%22having%22:%5B%5D%7D" rel="nofollow noreferrer">here</a></p>
  <p><a href="https://i.sstatic.net/Y8Rbc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y8Rbc.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-08T16:03:18.150Z
Answers.LastActivityDate: 2022-07-08T16:03:18.150Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>Thing which works is  "<strong>include/exclude custom search</strong>" : "Search -> Custom searches -> Include / Exclude Search" or <strong>/civicrm/contact/search/custom?csid=4&amp;reset=1</strong> Thanks @Coleman! </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-19T19:17:01.250Z
Answers.LastActivityDate: 2015-10-19T19:17:01.250Z
Answers.UserDisplayName: yurg
Body: <p>Have tried using API, but 
  <code>$result = civicrm_api3('Contact', 'get', array(
        'return' =&gt; "id",
        'contact_sub_type' =&gt; array('!=' =&gt; "Parent"),
  ));</code> </p>
  
  <p>gives zero results, while Search builder gives results using this query:</p>
  
  <p><code>Contact Subtype Not Like Parent ...AND...
  Contact Type = 'Individual'</code></p>
  
  <p>API calls also give zero results count if </p>
  
  <pre><code> 'organization_name' =&gt; array('IS NOT NULL' =&gt; 1),
  </code></pre>
  
  <p>and </p>
  
  <pre><code>'current_employer' =&gt; array('IS NOT NULL' =&gt; 1),
  </code></pre>
  
  <p>being used, although we know such records exist. Moreover, theree are records, where "Current employer' field is empty, which yet have Relationships. </p>
  
  <p>In theory, it might be possible to compare two arrays (all existent Relationships wjere Contact A is an Individual and all existent Individuals), but it might be tricky a bit at current number of records in both arrays (around 100K in each).  So, any reliable way to find Individual Contacts  with no Relationships, nor Employers? </p>
  
Tags: <contacts><api><relationships><searchkit><cli>
Title: Find Contacts with no Relationships
ThreadText: # Find Contacts with no Relationships
  
  (Asked by: username_0 on 2015-10-16)
  
  Have tried using API, but
  `$result = civicrm_api3('Contact', 'get', array(
  'return' => "id",
  'contact_sub_type' => array('!=' => "Parent"),
  ));`
  
  gives zero results, while Search builder gives results using this query:
  
  `Contact Subtype Not Like Parent ...AND...
  Contact Type = 'Individual'`
  
  API calls also give zero results count if
  
  ```
   'organization_name' => array('IS NOT NULL' => 1),
  
  ```
  
  and
  
  ```
  'current_employer' => array('IS NOT NULL' => 1),
  
  ```
  
  being used, although we know such records exist. Moreover, theree are records, where "Current employer' field is empty, which yet have Relationships.
  
  In theory, it might be possible to compare two arrays (all existent Relationships wjere Contact A is an Individual and all existent Individuals), but it might be tricky a bit at current number of records in both arrays (around 100K in each). So, any reliable way to find Individual Contacts with no Relationships, nor Employers?
  
  **Tags:** contacts, api, relationships, searchkit, cli
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2015-10-19. Score: 5 | Accepted answer
  
  Thing which works is "**include/exclude custom search**" : "Search -> Custom searches -> Include / Exclude Search" or **/civicrm/contact/search/custom?csid=4&reset=1** Thanks @username_1!
  
  
  ---
  
  ### Answer by username_1 on 2015-10-16. Score: 5
  
  One way of achieving your goal would be via a temporary group:
  
  1. Using advanced search, search for all contacts who *do* have a relationship (simply open the "Relationships" tab, enter nothing, and search - it will default to all active relationships).
  2. Add all the resulting contacts to a group (or make a smart group if you want to save yourself this step in the future).
  3. Using search-builder, find all contacts not in that group.
  
  PS: the "Parent" contact sub-type has nothing to do with relationships. Contact types are quite different in CiviCRM from relationships, and having one does not automatically bestow the other.
  
  > **Comments:**
  > **username_0**: Sorry it doesn't work unfortunately, Search builder still gives contacts with at least one Relationship.  
  > **username_1**: Try the include/exclude custom search  
  > **username_0**: Have tried several conditions, one which did the trick  *once(!)* is " Contact ->Group(s) -> Is null ". Thanks God I've added contacts found in a group than; haven't been able to repeat this  since: "Not in group" gives no results (mean, too much results);  no luck with 'Is null' / '≠' / 'Is empty'  as well. Moreover, it gives "random" results: sometimes it;s an empty set, sometimes it's a couple of records..  
  > **username_1**: Did you try the include/exclude custom search?  
  > **username_0**: It took me time to realise what "include/exclude custom search" means and where is it. For those who'd be interested, it's here: /civicrm/contact/search/custom?csid=4&reset=1 And this works, thanks! Wish I found it before.  
  
  ---
  
  ### Answer by username_2 on 2022-07-08. Score: 2
  
  Lots of years after the question was asked, but still a relevant question.
  
  You can find contacts without relationships using the 'without' join in SearchKit:
  
  See [here](https://dmaster.demo.civicrm.org/civicrm/admin/search#/create/Contact?params=%7B%22version%22:4,%22select%22:%5B%22id%22,%22display_name%22%5D,%22orderBy%22:%7B%7D,%22where%22:%5B%5D,%22groupBy%22:%5B%5D,%22join%22:%5B%5B%22Contact%20AS%20Contact_RelationshipCache_Contact_01%22,%22EXCLUDE%22,%22RelationshipCache%22,%5B%22id%22,%22%3D%22,%22Contact_RelationshipCache_Contact_01.far_contact_id%22%5D%5D%5D,%22having%22:%5B%5D%7D)
  
  [![enter image description here](https://i.sstatic.net/Y8Rbc.png)](https://i.sstatic.net/Y8Rbc.png)
  
  
  ---
  
  