Posted on May 20, 2017 at 10:23 am
Fastest ways to find duplicate records in MySQL.
If name is the column you want to find duplicates in:
SELECT col1 FROM table GROUP BY col1 HAVING count(*) > 1;
Is also possible to support multiple columns, like this:
SELECT col1, col2, COUNT(*) c FROM table GROUP BY col1, col2 HAVING c > 1;
Get the IDs of the duplicate rows with GROUP_CONCAT:
SELECT GROUP_CONCAT(id), name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;
- How to Install OpenSSH SSHD Server on Debian Linux
- Download Windows 10 19H1 Build 18252 ISO Images
- Download Windows 10 October 2018 Update 1809 ISO Files (Official)
- Disable MySQL Binary Logging (Turn Off Log_Bin Variable)
- Enable IPv6 on a Scaleway VPS After a Reboot
- How to Ping an IPv6 Address with Ping6 on Debian Linux
- Get Public IPv6 Address on Debian Linux
- Delete Symbolic Link (Softlink) on Linux
- Keep current version of config files when apt-get install on Debian
- Enable Disable Windows 7 Test Mode
- How to Extract Links from a Web Page in Linux
- PHP Library for Google Authenticator (Two Factor Authentication 2FA)
- Should I reboot Debian server after apt-get upgrade?
- How to check if a website is a scam?
- SetDefaultDllDirectories could not be located
- How to build ImageMagick so that it's statically built