title: Selecting minimum and grouping
body: <p>I have the following table:</p>
  
  <pre><code>id | product_id | quantity
  --------------------------
  1  | 222        | 25       
  2  | 222        | 35
  3  | 223        | 10
  </code></pre>
  
  <p>Now I want to select the lowest quantities grouped by product_id. In SQL this works as</p>
  
  <pre><code>SELECT product_id, MIN(quantity) FROM my_table GROUP BY product_id
  </code></pre>
  
  <p>The result of this query is the following</p>
  
  <pre><code>product_id | MIN(quantity)
  --------------------------
  222        | 25
  223        | 10
  </code></pre>
  
  <p>However, how can I use Django's database models to do the same?</p>
  
  <p>I tried </p>
  
  <pre><code>myModel.objects.filter(product__in=product_ids).annotate(Min("quantity")).values_list("product", "quantity__min")
  </code></pre>
  
  <p>This returns the full table.</p>