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: SQL

Re: SQL

From: Del Jenkins <djinx_at_nbnet.nb.ca>
Date: 2000/06/24
Message-ID: <Me855.418$xx.10464@sodalite.nbnet.nb.ca>#1/1

Hi
If I have understod you properly I believe the following Select statement will return the results you are looking for;

 SELECT ACCTNO, SSN
 FROM table1
 WHERE exists

      (select SSN
       FROM table1
       GROUP BY SSN
       HAVING COUNT(SSN)>1)
       ORDER BY SSN;

Let me know if this does the trick. Good luck.

Del

"Brian Vuong" <brian-vuong_at_usa.net> wrote in message news:sl80dq8je7f124_at_corp.supernews.com...
>
> Could someone help me with this. I have two fields, acctno ( account
> number) and ssn. I would like to write a query to obtain only the
 customers
> that have more than one account. To determine if someone has more than
 one
> account by checking for duplicate ssn. Both ssn and acctno are character
> fields. I spent two days to try to figure out, but I could not do it.
> There is only 1 table
>
>
>
> select acctno, name, ssn
> from table1
> where count(ssn)>1; <----------------this does not work.
>
>
> Sincerely,
>
> Brian
>
>
Received on Sat Jun 24 2000 - 00:00:00 CDT

Original text of this message

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