Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL : How to formulate the query
Is this a simple group by problem ? If that is so then:
select f2,
count(f1)
from fields
group by f2;
F2 COUNT(F1)
a 3 b 2 c 3
If that result is not what you are looking for, please contact me via email.
Rock.
In article <824he2$rkg$1_at_newton3.pacific.net.sg>,
"Chua Boon Yiang" <chuaby_at_hotmail.com> wrote:
> Hi
> presume i have these 2 fields in a table :
>
> F1 F2
> === ===
> 1 a
> 1 c
> 2 a
> 2 b
> 3 b
> 3 c
> 4 c
> 4 a
>
> I would like to get a stat of "how many with 'a' have 'b' or 'c' "
>
> eg
>
> a with b with
> b = 1 c = 1
> c = 2
>
> May i know how should i roughly come out with the SQL ?
>
> Thanks
> Boon Yiang
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Dec 02 1999 - 09:02:34 CST