title: sql, keep only max value and delete others
body: <p>I have this sort of table :</p>
  
  <hr>
  
  <p><strong>-id | name | memo</strong></p>
  
  <p>-1   |  Gotham |  s1ep1</p>
  
  <p>-2   |  Gotham |  s1ep3</p>
  
  <p>-3   |  Gotham |  s1ep5</p>
  
  <hr>
  
  <p>I would like to keep the entry with the max(memo) and delete others, so just keep the third one (ep5).</p>
  
  <p>I can retrieve the result of all max(memo) group by name like this :</p>
  
  <pre><code>    SELECT id,max(memo) FROM `reminder` group by name
  </code></pre>
  
  <p>But I don't find the proper way to delete others, even looking at similar topics.</p>
  
  <p>I expected something like "<em>delete every entries that are not in my selection</em>".</p>
  
  <pre><code>    delete from reminder where not exists (SELECT id,max(memo) FROM `reminder` group by name)
  </code></pre>
  
  <p>But it doesn't work, "<em>You can't specify target table 'reminder' for update in FROM clause</em>". I must do it badly. Thanks for help.</p>