title: Select row with most recent date per user where date is more than current date
body: <p>My table is:</p>
  
  <pre><code> id  user   date
   ---|-----|------------|
   1  | ab  | 2011-03-04 |
   2  | ab  | 2016-03-04 |
   3  | cd  | 2009-03-04 |
   4  | cd  | 2013-03-03 |
   5  | ef  | 2009-03-03 |
  </code></pre>
  
  <p>I need to select each distinct user with :</p>
  
  <p>"update" > date more than current date</p>
  
  <p>Result would be:</p>
  
  <pre><code> id  user   date
   ---|-----|------------|
   2  | ab  | 2016-03-04 |
   5  | ef  | 2016-03-03 |
  </code></pre>
  
  <p>"expired" > date less than current date</p>
  
  <p>Result would be:</p>
  
  <pre><code> id  user   date
   ---|-----|------------|
   3  | cd  | 2009-03-04 |
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>SELECT t1.* FROM tmp t1
  WHERE t1.date = (SELECT MAX(t2.date)
  FROM tmp t2 WHERE t2.user = t1.user
  AND YEAR(MAX(t2.date))&lt;(YEAR(CURRENT_TIMESTAMP)-1))
  order by user asc
  </code></pre>
  
  <p>It doesn't work. Result-set has 0 rows.
  Any ideas? Thanks. It'll help me so much..</p>