I want to delete the duplicate rows in a table using jdbc. 

I just tried to below code which is deleting all the records in a table

```
   String query="Delete from tests where product_id=20 and product_name='KINDLE001'";

```

Is there any way to delete the duplicate records and keep the last duplicate value in table.

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.

Any leads?