Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL
hi,
i think you want something like that:
select acctno, name, count(ssn)
group by acctno, name
having count(ssn) > 1
or (you were not clear)
select ssn, count(acctno)
group by acctno, name
having count(acctno) > 1
regards
Hakan
Brian Vuong wrote:
>
> 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
![]() |
![]() |