Bug #1346 | Finding Duplicates with GROUP BY | ||
---|---|---|---|
Submitted: | 19 Sep 2003 5:03 | Modified: | 19 Sep 2003 7:45 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
Version: | 4.0.12 | OS: | Windows (Windows 2000) |
Assigned to: | CPU Architecture: | Any |
[19 Sep 2003 5:03]
[ name withheld ]
[19 Sep 2003 7:45]
Indrek Siitan
The correct way to look for rows that have duplicates is: SELECT id, count(*) as n from emp_table GROUP BY id HAVING n > 1;
[19 Sep 2003 9:04]
[ name withheld ]
SELECT id, count(*) as n from emp_table GROUP BY id HAVING n > 1; I tried that way also. Same problem.