Skip to content

Instantly share code, notes, and snippets.

@tihoho
Created January 6, 2018 13:39
Show Gist options
  • Save tihoho/d952c1d18145ee2627b7b92023419390 to your computer and use it in GitHub Desktop.
Save tihoho/d952c1d18145ee2627b7b92023419390 to your computer and use it in GitHub Desktop.
Remove not-uniuqe values in table field
delete from MYTABLE where id in (
select id from (
select id, count(*) 'c' from MYTABLE where 1 group by MYFIELD having count(`c`) > 1
) as `items`
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment