Show all rows in MySQL that contain the same value

quadmud

New Member
I have a MySQL database:\[code\]ID | Name1 | Bob2 | James3 | Jack4 | Bob5 | James\[/code\]How would I return a list of all the columns where the same name appears more than once, eg, I'd like to return this:\[code\]1 | Bob2 | James4 | Bob5 | James\[/code\]I've written a count query:\[code\]SELECT Name, COUNT(Name) AS NumOccurrences FROM table GROUP BY Name HAVING ( COUNT(Name) > 1 )\[/code\]But that just returns something like this:\[code\]Bob | 2James | 2\[/code\]Whereas I want to return the full rows returned.Any help would be greatly appreciated, thanks.
 
Back
Top