title: SOQL - Querying for a list of users the current user is following
body: <p>In my app I display a list of the current users. I request it like this:</p>
  
  <h2>Attempt 1</h2>
  
  <pre><code>List&lt;User&gt; Following = [SELECT Id, Name, SmallPhotoUrl 
    FROM User 
    WHERE Id IN (
        SELECT ParentId 
        FROM EntitySubscription 
        WHERE SubscriberId = :UserInfo.getUserId()) 
      AND Id != :UserInfo.getUserId() 
    LIMIT 96];
  </code></pre>
  
  <p>This does exactly what it's supposed to when logged in as an admin but I found out that non-admins get an error: </p>
  
  <blockquote>
    <p>Implementation restriction: EntitySubscription only allows security
    evaluation for non-admin users when LIMIT is specified and at most
    1000</p>
  </blockquote>
  
  <p>OK, no big deal, I'll just slap a LIMIT on there like so:</p>
  
  <h2>Attempt 2</h2>
  
  <pre><code>List&lt;User&gt; Following = [SELECT Id, Name, SmallPhotoUrl 
    FROM User 
    WHERE Id IN (
        SELECT ParentId 
        FROM EntitySubscription 
        WHERE SubscriberId = :UserInfo.getUserId() 
        LIMIT 1000) 
      AND Id != :UserInfo.getUserId() 
    LIMIT 96];
  </code></pre>
  
  <p>Easy, right? WRONG. This gives the following: </p>
  
  <blockquote>
    <p>expecting a right parentheses, found 'LIMIT'</p>
  </blockquote>
  
  <p>OK...</p>
  
  <p>I then tried breaking it out like so:</p>
  
  <h2>Attempt 3</h2>
  
  <pre><code>List&lt;EntitySubscription&gt; sub = [SELECT ParentId 
    FROM EntitySubscription 
    WHERE SubscriberId = :UserInfo.getUserId() 
    LIMIT 1000];
  List&lt;Id&gt; ids = new List&lt;Id&gt;();
  for(EntitySubscription s : sub){
      ids.add(s.ParentId);
  }
  List&lt;User&gt; Following = [SELECT Id, Name, SmallPhotoUrl 
    FROM User 
    WHERE Id IN (:ids) 
      AND Id != :UserInfo.getUserId() 
    LIMIT 96]; 
  </code></pre>
  
  <p>I crossed my fingers and...   </p>
  
  <pre><code>Invalid bind expression type of LIST&lt;Id&gt; for column of type Id
  </code></pre>
  
  <p>Hmm, I'd seen examples where this seemed to be possible, such as on the <a href="http://boards.developerforce.com/t5/Apex-Code-Development/Invalid-bind-expression-type-of-SOBJECT/td-p/110378" rel="nofollow">developerforce boards</a>, so I'm at a bit of a loss now.</p>
  
  <p>So here we are. I need to select a list of user names and pictures that a particular user is following on Chatter. If there is a completely different way to go about it I'm open to it.</p>