title: Correlated subqueries using Ecto
body: <p>How would you go about writing a correlated subquery in <code>Ecto</code>?</p>
  
  <p>For example, what would be the equivalent of the SQL <code>SELECT</code> query: </p>
  
  <pre><code>--Heaviest Lemmings per Group
  SELECT ld.group_name, ld.id, ld.name, ld.weight
  FROM lemming_data ld
  WHERE weight = (
      SELECT max(weight)
      FROM lemming_data
      WHERE group = ld.group_name
  );
  </code></pre>
  
  <p>in <code>Ecto</code> syntax? I'm not sure how to refer to the outer query's <code>group_name</code>.</p>