title: How to join each record of table 1 with few records of table 2?
body: <p>I have two tables named report_instance and report_history (report_instance has many report_history). I want to join each report_instance with first 10 records of report_history.</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>report_instance r1 has 20 report_history
  report_instance r2 has 5 report_history
  </code></pre>
  
  <p>The query should give me the result of joining r1 with first 10 records of 20 report_history and r2 with 5 report_history.</p>
  
  <p>My Query:</p>
  
  <pre><code>select * 
  from report_instances ri, report_history rh 
  where ri.id in (select rhh.id 
                  from report_history 
                  where rhh.report_instance_id=ri.id limit 10);
  </code></pre>
  
  <p>I got the error:</p>
  
  <blockquote>
    <p>This version of MySQL doesn't yet support 'LIMIT &amp; IN/ALL/ANY/SOME
    subquery'</p>
  </blockquote>