We help IT Professionals succeed at work.
Get Started

Need help with what appears to be a self join

brgdotnet asked
Last Modified: 2015-02-26
Suppose I have a table named "People", the first column is the ID,
the second is the FirstName and the third column is a character field
to indicate if a record is a duplicate record. I only need to flag the
duplicate records as duplicates, but not the very first record which belongs
to a group of duplicates. I think I would need to use a self join, but beyond
that I am lost. Can someone help me out please?

Table Before Query

ID     FirstName   IsDuplicate
12A    Nirma      
12A    Nirma
13E    Berry
13E    Berry
13E    Berry
13E    Berry
14A    Chastity
15X    Jim
15X    Jim

Table After Query. Duplicates are marked with a "Y" value
ID     FirstName   IsDuplicate
12A    Nirma        
12A    Nirma          Y
13E    Berry
13E    Berry            Y
13E    Berry            Y
13E    Berry            Y
14A    Chastity    
15X    Jim      
15X    Jim                Y
Watch Question
Database and Application Developer
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE