Finding Duplicate Records

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I would like to write a query to find any duplicate
records in a HOSTNAME field, can someone point me in the
right direction please?

Thanks,
Steve
 
Write a query that groups on HOSTNAME and also count how many times the HOSTNAME appears; then filter for those whose count is over 1...Here is the query assuming that the table is called tblHOSTNAME

SELECT HOSTNAME, Count(HOSTNAME)
FROM tblHOSTNAM
GROUP BY HOSTNAM
HAVING (((Count(HOSTNAME))>1))
 
Sorry, I should mention the column is
called "strHostName", and the table is "tblDevices".
However when I make those adjustments the query returns 1
record...the word "strHostName" and a value of "510". 510
is how many records are in the DB...
-----Original Message-----
Write a query that groups on HOSTNAME and also count how
many times the HOSTNAME appears; then filter for those
whose count is over 1...Here is the query assuming that
the table is called tblHOSTNAME:
 
SELECT strHostName, Count(strHostName)
FROM ttblDevice
GROUP BY strHostNam
HAVING Count(strHostName)>1

This should return all the names under strHostName with dups...My guess is that you forgot to include strHostName in the select statement.....
 
As you have probably noticed, I mistyped the table name tblDevices as ttblDevices in the previous post.
 
Back
Top