title: Table alias in ActiveRecord?
body: <p>I have the following to find posts.</p>
  
  <pre><code>@posts = Post.find(:all, 
  :select =&gt; "DISTINCT *",
  :include =&gt; [:user, {:track =&gt; :artist}],
  :conditions =&gt; ["user_id IN (?) AND NOT track_id = ?", users, @track.id],
  :group =&gt; "track_id", 
  :order =&gt; 'id desc', 
  :limit =&gt; '5')
  </code></pre>
  
  <p>I would like to add the subselect </p>
  
  <pre><code>(SELECT COUNT(*) FROM posts P2 
      WHERE P2.user_id = P1.user_id AND P2.id &gt; P1.id AND P2.track_id &lt;&gt; 34)
   &lt;= 1
  </code></pre>
  
  <p>in my conditions clause, to restrict the number of posts per user.</p>
  
  <p>How do I set the alias P1 to the "initial" posts table?</p>
  
  <p>Using rails 2.3.11</p>