Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to ?? sql query
Greg Hopkins wrote:
>
> How can I code SQL to do this ??
>
> I want to do something like:
>
> SELECT C1 FROM T WHERE COUNT(C1) = 2
>
You were looking in the right place. Try this:
Select C1, count(C1)
From T
Group by C1
Having count(C1) = 2;
Or this:
Create view C1_Counts as select C1, count(C1) "count" from T group by C1;
Select C1 from C1_Counts where count = 2;
Both should work.
-- --- Allen Kirby AT&T ITS Production Services akirby_at_att.com Alpharetta, GA.Received on Wed Jan 15 1997 - 00:00:00 CST
![]() |
![]() |