We help IT Professionals succeed at work.
Get Started

Partially duplicated records

J R asked
Last Modified: 2016-06-20
table1 A 
rowid > 
(SELECT min(rowid) FROM table1 B 
B.ID = A.ID);

Open in new window

The Above code will select duplicate rows, but will only return the rowID greater than one...  We need to return both duplicated rows.

In addition, the records we seek have duplicate values in some fields, but not all.  We need to return all fields for rows where field one, two and three are duplicated, but fields four five and six are not duplicated... And again, we need to return all fields within the partially duplicated records.

create table  table1(field1 number, field2 number, field3 number, field4 number, field5 number, field6 number) ;

insert into table1 values(1, 2, 3, 4, 5, 6);
insert into table1 values(1, 2, 3, 9, 9, 9);
insert into table1 values(1, 5, 3, 54, 15, 26);
insert into table1 values(1, 5, 3, 14, 65, 56);
insert into table1 values(9, 5, 3, 14, 65, 56);
insert into table1 values(7, 5, 3, 14, 65, 56); 

Open in new window

Expected results:

field1 field2 field3 field4 field5 field6
  1        2       3        4        5       6
  1        2       3        9        9       9
  1        5       3       54      15     26
  1        5       3       14      65     56

We need returned the two sets of two rows that are matched in the first three fields of each set.

Any and all suggestion & insights appreciated!!
Watch Question
Most Valuable Expert 2012
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 6 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