Reputation: 8836
I have this table below in mySQL with thousands of rows. If you notice 1, 2, 3 token are the same but the 3rd token has a different IP.
token ip
4aa1813449465a6ec1fc82e0ef09e2b1 2.17.58.126
4aa1813449465a6ec1fc82e0ef09e2b1 2.17.58.126
4aa1813449465a6ec1fc82e0ef09e2b1 94.71.213.235
d41d8cd98f00b204e9800998ecf8427e 63.24.23.129
My question is how can I end up with removing all duplicates rows ( token + ip ) ending with this
token ip
4aa1813449465a6ec1fc82e0ef09e2b1 2.17.58.126
4aa1813449465a6ec1fc82e0ef09e2b1 94.71.213.235
d41d8cd98f00b204e9800998ecf8427e 63.24.23.129
Upvotes: 0
Views: 34
Reputation: 41968
SELECT DISTINCT * FROM <table>;
To create a new cleaned up table:
SELECT DISTINCT * INTO <newtable> FROM <table>;
To clean up the table inline you would need to have a unique primary key, you cannot 'deduplicate' completely identical rows since you cannot target the individual duplicates.
Upvotes: 1