Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Unix Utils and wget in Windows
- increase mysql query speed
- Setup vi syntax for PHP
- EXCEL return to the next line in the same cell
- Get WAMP running on EC2
Thursday, July 17, 2014
check duplication of a column value in MySQL
To find the duplicate username in users table in MySQL:
SELECT username, COUNT(*) c
FROM `users`
GROUP BY username
HAVING c> 1
To get more detail information
SELECT firstname, lastname, username
FROM `users`
WHERE username IN
(
SELECT username
FROM `users`
GROUP BY username
HAVING COUNT(*) > 1
)
Labels:
MySQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment