title: How to delete the duplicate from rows from mysql db using java
body: <p>I want to delete the duplicate rows in a table using jdbc. </p>
  
  <p>I just tried to below code which is deleting all the records in a table</p>
  
  <pre><code>   String query="Delete from tests where product_id=20 and product_name='KINDLE001'";
  </code></pre>
  
  <p>Is there any way to delete the duplicate records and keep the last duplicate value in table.</p>
  
  <p>Like there is a column in table called S.NO 1,2,3 and 1,2 rows are duplicate then I just want to delete record 1. And keep 2, 3 unique records as It's.</p>
  
  <p>Any leads?</p>