Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

print all duplicate records

913578May 8 2018 — edited May 9 2018

Hi,

i am putting here the sample data, and would like to display all duplicate records.

I have data like below in table.

pastedImage_3.png

Currently i can be able to display the duplicate records using below query like this.

pastedImage_4.png

But i wanted to display all duplicate records, like below

A B C D

----------------------

1 2 3 NULL

1 2 3 NULL

1 2 3 NULL

I tried using below query

SELECT * FROM T10 WHERE (A,B,C,D) IN (

SELECT A,B,C,D FROM T10 WHERE ROWID NOT IN (SELECT MIN(ROWID) FROM T10 GROUP BY A,B,C))

But its returning me 0 records, might be due to having NULL values.

Please suggest me the query.

Script for the sample data

=======================

CREATE TABLE T10 (A NUMBER,B NUMBER,C NUMBER, D NUMBER);

INSERT INTO T10 VALUES (1,2,3,null);

INSERT INTO T10 VALUES (1,2,3,null);

INSERT INTO T10 VALUES (1,2,3,null);

INSERT INTO T10 VALUES (1,2,4,null);

INSERT INTO T10 VALUES (1,null,3,6);

This post has been answered by mathguy on May 9 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2018
Added on May 8 2018
9 comments
314 views