Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Select rows where field value is the same

Re: Select rows where field value is the same

From: Chris Weiss <weisschr_at_pilot.msu.edu>
Date: Wed, 26 May 1999 14:19:48 -0400
Message-ID: <7ihdpp$mb6$1@msunews.cl.msu.edu>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US