Re: Simple Query Question?

From: <Alain.Collin_at_ping.be>
Date: 1996/01/21
Message-ID: <4dtp91$7rv_at_ping1.ping.be>#1/1


Hi Jelle Paul,

Your problem is a typical OUTER-JOIN problem. You can read more about outer-joins in the SQL Language manual.

The following SQL statement should return you the correct result :

select p.name, s.name
from people p, supervisors s
where p.supervisor_number = s.number(+)

For any additional info do not hesitate to Email me.

Kind Regards,
Alain

jalten_at_cs.vu.nl (Alten JP) wrote:

>Hi, I think I have a simple question....
 

>If I have a table with information on people, including the
>fields number, name and supervisor_number
>What if I want the names of all people, and if they have
>a supervisor (supervisor_number is not zero) then I want the name
>of the supervisor too.
>I can try this:
>select p.name, s.name where p.supervisor_number=s.number
>but that would not give me all people....
 

>trying something like this:
>select p.name, s.name
>where p.supervisor_number=s.number or p.supervisor_number=0
>returns an error.
 

>Any suggestions?
>It would be nice if the query is not nested...
 

>Thanks,
 

>Jelle Paul
 

>
>--
>+-------------------------------------------------------+
>| Jelle Paul Alten | jalten_at_cs.vu.nl |
>| Vrije Universiteit Amsterdam | |
>+-------------------------------------------------------+
Received on Sun Jan 21 1996 - 00:00:00 CET

Original text of this message