title: How to limit LEFT JOIN to one result AND return lowest value from the result set?
body: <p>Suppose I have a query like this:</p>
  
  <pre><code>SELECT t1.name, t2.likes
  FROM table_1 t1
  LEFT JOIN table_2 t2 ON t1.name = t2.name
  </code></pre>
  
  <p>How could that left join be modified to make it do the following:</p>
  
  <pre><code>SELECT likes FROM table_2 WHERE name = [name from table 1] ORDER BY likes ASC
  </code></pre>
  
  <p>I tried writing a subquery, but it didn't work because (I assume) you can't use a variable from outside the subquery (e.g. the name) inside the subquery (the name is not constant, as the result set from the query will be more than one).</p>
  
  <p>Is that possible to do?</p>
  
  <p>EDIT: The tables would be something like this:</p>
  
  <p>table_1:</p>
  
  <pre><code>+------+--------+
  | id   |  name  |
  +------+--------+
  |  0   |  cat   |
  |  1   |  dog   |
  +------+--------+
  </code></pre>
  
  <p>table 2:</p>
  
  <pre><code>+------+--------+---------+
  | id   |  name  |  likes  |
  +------+--------+---------+
  |  0   |  cat   |   23    |
  |  1   |  cat   |   2     |
  |  2   |  cat   |   53    |
  |  3   |  dog   |   25    |
  |  4   |  dog   |   12    |
  +------+--------+---------+
  </code></pre>
  
  <p>So, what I'm wanting is:</p>
  
  <pre><code>+--------+---------+
  |  name  |  likes  |
  +--------+---------+
  |  cat   |   2     |
  |  dog   |   12    |
  +--------+---------+
  </code></pre>