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: query sql problem

Re: query sql problem

From: Josh Miller <jmiller_at_iterated.com>
Date: 2000/03/13
Message-ID: <38cd17c4$0$29553@wodc7nh6.news.uu.net>#1/1

How about:

select Agent.agent_name, count(*)
  from Agent, Agent_child
 where Agent_child.id_agent = Agent.id_agent group by Agent.agent_name

should work fine if you want any with at least one child. If you want to see agents with at least two (or any value greater than one) add the following line to the end of the query:

having count(*) >= (put some number here)

Hope this helps,
Josh Miller

ummo14 <ummo14NOumSPAM_at_hotmail.com.invalid> wrote in message news:17c3e310.88eadd6e_at_usw-ex0110-075.remarq.com...
> i have 3 tables:
> I have 3 tables
> table1:Agent
> column: id agent
> column: agent name
>
> table2:Agent_child
> column: id agent
> column: id child
> table3:Child
> column: id child
> column: name child
>
> If a Sql guru could help me It will be great for me. I want
> to select the name of the agents which have at least one
> child (if it's possible in displaying the number of child
> beside the name of the agents)
>
>
>
> * Sent from AltaVista http://www.altavista.com Where you can also find
related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful Received on Mon Mar 13 2000 - 00:00:00 CST

Original text of this message

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