MySQL Forums
Forum List  »  Newbie

Re: Find double (not uniqe) entries in a table
Posted by: Roland Bouman
Date: August 18, 2005 04:46PM

assuming id is always unique

select id
, name
, city
from table1 t1
where exists (
select null
from table1 t2
where t1.name = t2.name
and t1.id <> t2.id
)

if id by itself is not unique, you can add the city field too:

select id
, name
, city
from table1 t1
where exists (
select null
from table1 t2
where t1.name = t2.name
and (t1.id <> t2.id
or t1.city <> t2.city)
)

Options: ReplyQuote


Subject
Written By
Posted
Re: Find double (not uniqe) entries in a table
August 18, 2005 04:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.