sql server - Finding duplicate entries SQL -


i have table of called member(unique id memberid) has numerous member duplicates first , last names being different, business name, address, city, state , zip codes same. records imported duplicates.

how can run script find duplicate members businessname, addr1, city, state, , zip same.

i want list them on page, can choose ones eliminate.

any ideas how can create script this?

many in advance,

paul

select * member m exists(select memberid        member m2                    (m.businessname = m2.businessname or (m.businessname null , m2.businessname null)) ,             (m.addr1 = m2.addr1 or (m.addr1 null , m2.addr1 null)) ,             (m.city = m2.city or (m.city null , m2.city null)) ,             (m.state = m2.state or (m.state  null , m2.state null)) ,             (m.zip = m2.zip or (m.zip  null , m2.zip null)) ,             m.memberid <> m2.memberid) 

with above query checking see if duplicate entry exists. subquery returns result if there copy memberid not match. means if there unique row there no results whereas if there row 1 or more copies returned.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -