Skip to content

Instantly share code, notes, and snippets.

@sintret
Last active March 23, 2019 09:32
Show Gist options
  • Save sintret/a44225567ee6d4ed880a500ccda2e0c6 to your computer and use it in GitHub Desktop.
Save sintret/a44225567ee6d4ed880a500ccda2e0c6 to your computer and use it in GitHub Desktop.
mysql find duplicate
SELECT a.phone, b.phone, a.companyId , b.companyId , a.id,b.id
FROM member a, member b
WHERE a.phone = b.phone
AND a.companyId = b.companyId
AND a.id <> b.id
SELECT phone, COUNT(*) c FROM member GROUP BY phone HAVING c > 1;
SELECT GROUP_CONCAT(companyId), phone, COUNT(*) c FROM member GROUP BY phone HAVING c > 1;
INSERT INTO mytable (uid,`session`,counting,`type`,ft,isFilter ) SELECT uid,`session`,counting,`type`,ft,isFilter FROM mytableother WHERE id = 1
for mysql 8
login as root
ALTER USER 'myuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my password';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment