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: how many people have more than 2 cars

Re: how many people have more than 2 cars

From: Steve Long <steven.long_at_erols.com>
Date: Wed, 25 Apr 2001 17:54:03 -0400
Message-ID: <9c7h6v$k3j$1@bob.news.rcn.net>

noting that you ask "how many" rather than "which ones", the query is as follows:

select count(*)
from (select 'x' from table2 group by pid having count(*) > 2)

enjoy!

"Ben Thomas" <bthomas_at_strider.localdomain> wrote in message news:9c7dq1$2kip$1_at_allthetime.news.cais.net...
> I ask this question by example:
>
> {table1}:
> person_id
>
> {table2}:
> person_id
> car_id
>
> each person has one entry in {table1} and zero, one or more entries in
> {table2}.
>
> I want to know how may people have more than 2 cars.
> Seems easy but I am missing something.
>
>
> help?
> Much thanks in advance.
>
> Ben
Received on Wed Apr 25 2001 - 16:54:03 CDT

Original text of this message

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