List:MySQL on Win32« Previous MessageNext Message »
From:Gerhard Brauckmann Date:August 5 2004 9:38am
Subject:AW: how to find duplicated entries within a table?
View as plain text  
Bingo ! works fine

many thx
regadrs
Gerhard 

-----Ursprüngliche Nachricht-----
Von: Ian Gibbons [mailto:mysql1@stripped] 
Gesendet: Donnerstag, 5. August 2004 11:17
An: Gerhard Brauckmann; win32@stripped
Betreff: Re: how to find duplicated entries within a table?

On 5 Aug 2004 at 10:50, Gerhard Brauckmann wrote:

> Hello all,
> 
> I m trying to find duplicate entries in a specific table colum.
> Does anyone of you have an idea how to do this by query?
> 
> example, my data: "John", "Willi", "Martha", "John", "Mike", "Sammy",
"Mike"
> 
> Now i would select ONLY the double entries in this data-table.
> The result should look like this:
> 
> John,John, Mike, Mike

Hi,

We could do with a bit more information about your table structure to get
this right. 

But here's a guess anyway...

If the the column which you are checking is called *FirstName* then the
query would be:

SELECT FirstName, Count(FirstName) as
DuplicateCount
FROM tablename
GROUP BY FirstName
HAVING DuplicateCount>1;

This would give you a list if all the FirstName's that appear more than
once.

For more information on the GROUP BY syntax see the manual at:

<http://dev.mysql.com/doc/mysql/en/GROUP-
BY-Functions.html>


Regards

Ian
-- 



Thread
Left Join slow on WindowsJohn McQuillen23 Jul
  • Re: Left Join slow on WindowsPetr Vileta23 Jul
    • Re: Left Join slow on WindowsJohn McQuillen23 Jul
      • Re: Left Join slow on WindowsSGreen23 Jul
  • how to find duplicated entries within a table?Gerhard Brauckmann5 Aug
AW: how to find duplicated entries within a table?Gerhard Brauckmann5 Aug
RE: how to find duplicated entries within a table?Cesar Vega5 Aug