Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicates

Status
Not open for further replies.

thembela

Technical User
Jun 4, 2005
29
ZA
I’ve just found out that some information has been entered more than once in the Customer Name & Plant Filed .So Now what I want to do is to write a query that will give me only the Customer names & Plant that were entered more than once. And leave out the Names that were entered once.This is an example of my data base below:



Cust_No Customer Name Plant
0001 Mobil Oil 89
0002 Mobil Oil 89
0003 Mobil Oil 89
0004 Texas 70
0005 Texas 70
0006 Petro 50
0007 Enron 20
0008 Gesco 30
 
Code:
select [Customer Name]
     , Plant
     , count(*) as dupes
  from yourtable
group
    by [Customer Name]
     , Plant
having count(*) > 1

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top