Jennifer Goodie wrote:
>Why the join? Why not just "select p1.email, count(*) as occurances from
>table p1 group by p1.email having occurances > 1"? Am I missing something?
Possibly. It depends on whether the OP wanted to see which rows had
duplicates, or to actually *see* the duplicates, in which case a join
would be needed. (It would not, however, be quite the join shown
below... one query would find the rows with duplicates and yield a
temporary table, and then the second would join that table back to the
original to find the details.
>>You have to do a self join - try this off the top of my head... -
>>FROM tblperson p1, tblperson p2
>>WHERE p1.email = p2.email
>>GROUP BY p1.email
>>HAVING count(p1.email) > 1