Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: query sql problem
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
![]() |
![]() |