[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Identifying Duplicate Listings in Two Columns
I tested this out on Oracle and it seems to do what you are asking for.
NOTE the distinct will cause you to only get one occurance of each row that
is duplicated in the data base. If you want to see every occurance just
take the DISTINCT out.
Begin-Select DISTINCT
Column_A
Column_B
FROM table T
Where 1 < (SELECT count(*)
FROM table T1
WHERE T1.Column_A = T.Column_A
AND T1.Column_B = T.Column_B)
End-Select
Regards,
Darrin
> I need to write a report which will print all rows where the data in
columns
> A and B are both duplicated at the same time. In the example below I would
> want the report to print rows 1, 2, 5, 7, 8.
>
> I have been able to identify the duplicates in Column A by using "where
> Column_A in(select Column_A from table group by Column_A having
> count(*)>1)". I have been unsuccessful at trying to apply this same
process
> to both columns at the same time. Any help will be greatly appreciated.
>
> Thanks
>
> Bob
>
> Row # Column A Column B
> 1 1000 blue
> 2 1000 blue
> 3 1000 green
> 4 1000 red
> 5 2000 yellow
> 6 2000 green
> 7 2000 yellow
> 8 2000 yellow
> 9 3000 red
> 10 3000 blue