title: Attachments in Apex SOQL Subquery
body: <p>I have custom objects Team member and Employment, and there's a lookup relationship from employment(many) to team member(one), plus another lookup record on team member called <code>current employment</code>.</p>
  
  <p>The employment record may have attachments.</p>
  
  <p>I want a SOQL query, to run in an APEX class, which will return attachments information for specific team members.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>SObject[] results = [select id,(select id,name from Attachments) from Employment__c where id in (select Current_Employment__c from Team_Member__c where id=:id)];
  </code></pre>
  
  <p>Wnen I run the query in the schema browser, it works OK and I'm able to drill-down to the attachments, but when I run it in Apex (Anonymous), the result set does not contain the attachments:</p>
  
  <pre><code>for (SObject result : results) {
    System.debug(result);
  }
  </code></pre>
  
  <p>I can only see the Employment id in the results.</p>
  
  <p>How can I get attachments in APEX?</p>