Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HELP! Oracle script for identify identical records
On 18 Jul, 16:41, "ko" <ko..._at_singnet.com.sg> wrote:
> I have a table which consists of n columns. I need to list those identical
> records.
> The coditions for identical records are column A and column B of those
> records must contain the same value and column C must contain 'Y'.
> Can someone enlighten me how to write an Oracle SQL script to accomplish
> this?
>
> Many thanks for your help.
What have you tried so far? Anyway, you want something like the following:
SELECT <column_A>, <column_B>, <column_C>, count(*)
FROM <table_name>
WHERE <column_A> = <column_B> AND <column_C>='Y'
GROUP BY <column_A>, <column_B>, <column_C>
HAVING COUNT(*) > 1;
HTH
-g
Received on Thu Jul 19 2007 - 06:23:50 CDT