Created
August 1, 2016 13:27
-
-
Save mavvverick/85df6850d82f16317884d28d111cb5e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Create temproray table by picking min duplicate id and delete | |
delete table from table inner join | |
(select min(id) minid, sample_data, sample_data1, sample_data2 | |
from table | |
group by ssample_data, sample_data1 | |
having count(1) > 1) as duplicates | |
on (duplicates.minid = search_search.id) | |
## Keep only duplicate entry and delete rest | |
delete table from table inner join | |
(select min(id) minid, sample_data, sample_data1, sample_data2 | |
from table | |
group by sample_data, sample_data1 | |
having count(1) > 1) as duplicates | |
on ( | |
duplicates.sample_data = search_search.sample_data | |
duplicates.minid <> search_search.id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment