Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL
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
![]() |
![]() |