Last active
November 18, 2016 02:15
-
-
Save eatgrass/c056f4c2171ada6aa70fa728ff46782a to your computer and use it in GitHub Desktop.
MySql snippets
This file contains 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
select | |
nickname, count(id) as cnt | |
from | |
customer | |
group by | |
nickname having cnt > 1 |
This file contains 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
update login a, | |
(select a.id | |
from login a, | |
(select email, count(id) as num | |
from login | |
group by email | |
having count(id) >= 2) b | |
where a.email = b.email) b | |
set a.email = concat(a.id, '@old-email.local') | |
where a.id = b.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment