title: How to expand MySQL subquery/join to include all rows
body: <p>This query below is perfect in producing the result for <code>horse_id = 1</code> ... but I want to do this for all horses in the database. Can anyone share with me how to tweak this query so I can do that?</p>
  
  <pre><code>SELECT  figures.entry_id,
          max(figures.beyer)
  FROM
          ( SELECT  hrdb_lines.horse_id,
                    hrdb_entries.entry_id,
                    hrdb_lines.beyer
            FROM hrdb_entries
              INNER JOIN hrdb_lines 
                  ON hrdb_lines.horse_id = hrdb_entries.horse_id
            WHERE hrdb_lines.horse_id = 1
            ORDER BY hrdb_lines.line_date DESC
            LIMIT 2
          ) as figures
  </code></pre>
  
  <p>Perhaps I'm doing it all wrong too.</p>