title: Join with indices (not database index) of right table
body: <p>I have a one to many relationship and want to join the right table while including an index number for each of the rows on the many table.</p>
  
  <p>For instance:</p>
  
  <p>user table</p>
  
  <pre><code>id | name
   1 | me
   2 | you
  
  attempted table
  user_id | date 
        1 | 2014-03-01
        1 | 2014-03-03
        1 | 2014-03-02
        2 | 2014-02-01
  
  join result
  user_name | date       | attempt_number
         me | 2014-03-01 | 0     
         me | 2014-03-02 | 1
         me | 2014-03-03 | 2
        you | 2014-02-01 | 0
  </code></pre>