title: Select only latest results for every unique foreign key
body: <pre><code>class Price(models.Model):
      product = models.ForeignKey(Product)
      date = models.DateField()
      amount = DecimalField()
  </code></pre>
  
  <p>Have model where stored amounts for many products on many date(date may be in future time).</p>
  
  <blockquote>
    <p>Example:<br/>  on 1.01.2013  - Product1 amount  10$  (i.e. this value
    from 1.01 to 11.01)<br/> on 12.01.2013  - Product1 amount  12$<br/> on
    10.05.2013  - Product1 amount  17$<br/> on 11.06.2013  - Product1 amount  14$<br/></p>
    
    <p>on 18.02.2013  - Product2 amount  3$<br/> on 12.06.2013  - Product2
    amount  15$<br/></p>
    
    <p>on 25.04.2013  - Product3 amount  11$<br/> on 17.06.2013  - Product3
    amount  13$<br/></p>
  </blockquote>
  
  <p>DB Backend-MySQL</p>
  
  <p>How may select select <strong>actual</strong> amount(and date entered of this amount) for every product with date &lt;= current_date and amount value in user-entered range<br/>
  For ex. on date 14.05.2013 and amount range 10-20$
  need result with only two objects in queryset:<br/></p>
  
  <pre><code>Product1   10.05.2013  17$
  Product3   25.04.2013  11$ 
  </code></pre>
  
  <p>UPD. Interested <strong>optimal</strong> solution, not need many SQL queries and not need in code evaluate cycle of all records. </p>