title: How to select min date group by name with repeated ids
body: <p>I have a table with <code>id</code>, <code>name</code>, <code>date</code> and <code>value</code></p>
  
  <p>My table is:</p>
  
  <pre><code>id  name   date         value 
  ---|------|------------|-------------
  1  | john | 01/03/2017 | 399 
  1  | john | 02/03/2017 | 244
  1  | paul | 01/03/2017 | 555
  1  | paul | 02/03/2017 | 313
  2  | john | 03/04/2017 | 433
  2  | john | 04/04/2017 | 651
  2  | paul | 05/04/2017 | 657
  2  | paul | 06/04/2017 | 131
  3  | john | 03/05/2017 | 656
  3  | john | 24/05/2017 | 543
  3  | paul | 01/05/2017 | 114
  3  | paul | 02/05/2017 | 966
  </code></pre>
  
  <p>I need to select min date group by name and his value.</p>
  
  <p>I need to get this:</p>
  
  <pre><code>id  name   date         value 
  ---|------|------------|-------------
  1  | john | 01/03/2017 | 399     
  1  | paul | 01/03/2017 | 555
  2  | john | 03/04/2017 | 433
  2  | paul | 05/04/2017 | 657
  3  | john | 03/05/2017 | 656
  3  | paul | 01/05/2017 | 114
  </code></pre>
  
  <p>I have tried this mysql query:</p>
  
  <pre><code>SELECT  a.*
  FROM    mytable a
          INNER JOIN 
          (
              SELECT  name, MIN(date) mindate
              FROM    mytable 
              GROUP   BY name
          ) b ON a.name = b.name
                  AND a.date= b.mindate
                  ORDER BY a.id
  </code></pre>