title: mySQL How to SELECT MAX(date) from duplicate values without group
body: <p>I have this table:</p>
  <pre><code>id   obj_nr   el_nr   location   date
  0    1234     1        a3         2020-01-01
  1    1234     2        a2         2020-01-02
  2    1234     3        a4         2020-01-03
  3    1234     1        a9         2020-01-04
  </code></pre>
  <p>No i want to concat obj_nr and element_nr to find duplicates.<br>
  When i find a duplicate i wan't only to select the one with the latest date.</p>
  <p>The result should be:</p>
  <pre><code>id   obj_nr   el_nr   location   date
  1    1234     2        a2         2020-01-02
  2    1234     3        a4         2020-01-03
  3    1234     1        a9         2020-01-04
  </code></pre>
  <p>How should my query look like?</p>
  <p>This is what i've tried:</p>
  <pre><code>SELECT MAX(id) id, obj_nr, el_nr, location, max(date_scanned)
  FROM  element_location WHERE obj_nr = :obj_nr
  GROUP BY obj_nr, el_nr, location
  </code></pre>
  <p>But this will not give me the latest duplicate.</p>