Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select rows where field value is the same
Try a self-join
select distinct [field list prefixed with a.]
from <table> a, <table> b
where a.empno = b.empno
and a.rowid != b.rowid;
However, I would check for the number of rows first:
select sum(a)
from
(
select empno, count(*) a from <table>
group by empno
having count(*) > 1
);
Christopher Weiss
Professional Services Division
Compuware Corporation
analyst_user_at_my-deja.com wrote in message <7ihc0l$3lo$1_at_nnrp1.deja.com>...
>I'm fairly new to Oracle so I'm having a problem with something I want
>to do.
>
>I have a field called EMPNO in a fairly large table. I want to return
>all rows where the value of EMPNO repeats.
>
>
>--== Sent via Deja.com http://www.deja.com/ ==--
>---Share what you know. Learn what you don't.---
Received on Wed May 26 1999 - 13:19:48 CDT