Body: <p>To optimize performance, I'm trying to create an advanced entry query that selects only specific variables. I can set up the query to grab the entry title, uri, and a custom variable I created ("email" variable). But I don't know how to also select an asset as well. I basically want to create an advanced query that lets me publish the name, uri, email and asset (image variable called 'headshot'). </p>
  
  <p>Here's what I have. Just not sure what I need to also add in mu <code>select</code> to get my image asset.</p>
  
  <pre><code>{% set entries = craft.entries()
      .section('persons')
      .select('elements.id, elements_sites.uri, elements_sites.siteId, entries.sectionId, entries.typeId, content.id, content.title, content.email')
      .with(['headshot']
      .all()
  %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-19T14:21:39.660Z
Comments.Text: Does the entries have the asset field named "headshot"?
Comments.UserDisplayName: Kota.M
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-19T23:42:43.910Z
Comments.Text: @Kota.M Yup, the asset field is "headshot."
Comments.UserDisplayName: user3092
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-22T20:12:25.560Z
Comments.Text: As far as I read the document (https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html) it seems to be fine except for ")" is missing after the end of "with".
Comments.UserDisplayName: Kota.M
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-05T22:55:26.867Z
Comments.Text: @Kota.M The missing ")" was a typo when I posted this. The code with the ")" doesn't work, unfortunately.
Comments.UserDisplayName: user3092
Tags: <elementquery>
Title: Advanced queries with assets and other custom fields
ThreadText: # Advanced queries with assets and other custom fields
  
  (Asked by: username_0 on 2019-07-18)
  
  To optimize performance, I'm trying to create an advanced entry query that selects only specific variables. I can set up the query to grab the entry title, uri, and a custom variable I created ("email" variable). But I don't know how to also select an asset as well. I basically want to create an advanced query that lets me publish the name, uri, email and asset (image variable called 'headshot').
  
  Here's what I have. Just not sure what I need to also add in mu `select` to get my image asset.
  
  ```
  {% set entries = craft.entries()
      .section('persons')
      .select('elements.id, elements_sites.uri, elements_sites.siteId, entries.sectionId, entries.typeId, content.id, content.title, content.email')
      .with(['headshot']
      .all()
  %}
  
  ```
  
  **Tags:** elementquery
  
  > **Comments:**
  > **username_1**: Does the entries have the asset field named "headshot"?  
  > **username_0**: @username_1 Yup, the asset field is "headshot."  
  > **username_1**: As far as I read the document (https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html) it seems to be fine except for ")" is missing after the end of "with".  
  > **username_0**: @username_1 The missing ")" was a typo when I posted this. The code with the ")" doesn't work, unfortunately.  
  
  ---
  
  ## 0 answers
  
  