Re: Simple Query Question?

From: Gerrit Breebaart <gbreebaa_at_assai.nl>
Date: 1996/01/21
Message-ID: <DLIuMr.rn_at_inter.NL.net>#1/1


In article <DLI6vD.F7y.0.-s_at_cs.vu.nl>, jalten_at_cs.vu.nl (Alten JP) says:
>
>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 | |
>+-------------------------------------------------------+

Jelle,

Try the first example again using an outer join construction, that should do the trick.

e.g.

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

(which means something like 'also give me those p's without any s's)

Gerrit Received on Sun Jan 21 1996 - 00:00:00 CET

Original text of this message