Re: Simple Query Question?y
From: <x93rathi1_at_wmich.edu>
Date: 1996/01/21
Message-ID: <1996Jan21.132035_at_winnie>#1/1
>>
>>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 | |
>>+-------------------------------------------------------+
Date: 1996/01/21
Message-ID: <1996Jan21.132035_at_winnie>#1/1
In article <DLIuMr.rn_at_inter.NL.net>, gbreebaa_at_assai.nl (Gerrit Breebaart) writes:
> 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) > > GerritReceived on Sun Jan 21 1996 - 00:00:00 CET