Peter,

That comes pretty close to the distinct -thread in this mailinglist.
You might want to try:

SELECT device, count(hostname)
FROM your_table
GROUP BY device
HAVING count(hostname)>1;

This would display all devices with at least 2 (or more) hostnames.
If you always have the same IP address, and the same comments allocated to a
certain device, then and only then you can add IP and comments to the SELECT
and GROUP BY statement.

Vary this as needed or pleased

Hope that helps 
And the manual is great too:
http://www.mysql.com/doc/G/r/Group_by_functions.html
http://www.mysql.com/doc/S/E/SELECT.html

Hannes


On 6/27/01 1:13 PM, "Pete Kuczynski" <[EMAIL PROTECTED]> wrote:

> Hi,
> How would a word a select statment, to search a database for duplicate
> entries in one field.
> 
> For example, the fields: device, hostname, IP, comments
> 
> I want to find all instances where there my be two devices with the same
> hostname.
> 
> Thanks!
> 
> Pete


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to