Skip to Main Content

DevOps, CI/CD and Automation

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!

How to find the duplicate rows for multiple columns in a sql query

Ranjith_1996Dec 22 2021

Hi,
I am having around 200 columns in a select query. And the query output is having greater than 3000 rows. So, I want to know, is there any way to find duplicate rows present in the sql query output?
Is it possible to find? Any help would be really helpful. Thanks in Advance.
<

Comments

WITH dup_count AS( SELECT
    t.*,
    COUNT(*) over (PARTITION BY col1, col2, <add_your_columns_here>) c
FROM tab1 t )
SELECT * FROM dup_count
 WHERE c > 1;

Use Analytics function.

1 - 1

Post Details

Added on Dec 22 2021
1 comment
7,951 views