Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query to find non-unique records
"ewong" <ewong_at_ewong.com> wrote in message
news:3AE73AAA.D72BE84_at_ewong.com...
> I have a table:
> id integer,
> tag1 varchar2(5),
> tag2 varchar2(5),
> text clob
> ...
>
> The primary key is (id,tag1,tag2). I disabled the pk couple days ago
> and find that I am not able to enable it anymore because some new
> records don't have unique pks on the three columns. How can I do query
> to track down those non-unique records?
>
> Thanks.
>
select id,tag1,tag2
from my_table
group by id,tag1,tag2
having count(*) > 1
Received on Wed Apr 25 2001 - 16:00:18 CDT