Answers.Body: <p>You first need to query for all post entries and then query for the authors that are related to a post. You can use the <code>ids()</code> method to get just the author’s element IDs, which is a lot quicker than <code>find()</code>.</p>
  
  <pre><code>{% set allPostIds = craft.entries({
      section: 'posts',
      limit: null,
  }).ids() %}
  
  {% set people = craft.entries({
      section: 'people',
      relatedTo: {
          sourceElement: allPostIds,
          field: 'people',
      },
  }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T14:49:32.797Z
Answers.Text: Great, but to confuse matters I have two People entry fields: Authors and People - I only want to match authors... any idea how I could do that?
Answers.UserDisplayName: Daniel
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T15:04:34.253Z
Answers.Text: Sure, I just updated the answer.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-03T12:37:33.893Z
Answers.LastActivityDate: 2017-04-03T15:03:58.527Z
Answers.LastEditDate: 2017-04-03T15:03:58.527Z
Answers.UserDisplayName: carlcs
Body: <p>I have a section <code>Posts</code> that has an Entries-type field called <code>Authors</code> that can be linked to one or more entries in section called <code>People</code>. To make a filter for my posts index, I need to fetch all the <code>People</code> entries that have been linked to any post via the Authors field, but I can't wrap my head around how to do this.</p>
  
  <p>Any ideas appreciated!</p>
  
Tags: <relatedto>
Title: Fetch target entries that have been linked through an Entries field
ThreadText: # Fetch target entries that have been linked through an Entries field
  
  (Asked by: username_0 on 2017-04-03)
  
  I have a section `Posts` that has an Entries-type field called `Authors` that can be linked to one or more entries in section called `People`. To make a filter for my posts index, I need to fetch all the `People` entries that have been linked to any post via the Authors field, but I can't wrap my head around how to do this.
  
  Any ideas appreciated!
  
  **Tags:** relatedto
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-03. Score: 4 | Accepted answer
  
  You first need to query for all post entries and then query for the authors that are related to a post. You can use the `ids()` method to get just the author’s element IDs, which is a lot quicker than `find()`.
  
  ```
  {% set allPostIds = craft.entries({
      section: 'posts',
      limit: null,
  }).ids() %}
  
  {% set people = craft.entries({
      section: 'people',
      relatedTo: {
          sourceElement: allPostIds,
          field: 'people',
      },
  }) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Great, but to confuse matters I have two People entry fields: Authors and People - I only want to match authors... any idea how I could do that?  
  > **username_1**: Sure, I just updated the answer.  
  
  ---
  
  