Re: Outer Join

From: nick <nick-love_at_juno.com>
Date: Sat, 31 Mar 2001 19:30:08 -0000
Message-ID: <tccc202g9nb685_at_corp.supernews.com>


dennishancy wrote:
>
>
> I have two tables: 1) Employee Table, and 2) Lookup Table.
>
> The primary key of the Employee table is SSN, and is also a foreign key
> within
> the Lookup table.
>
> The primary key of the Lookup table is an ID number, indicating the type
 of
> information being looked up.
>
> I'm interested in producing a list of all employees within a certain
> department
> along with certain items in this lookup table.
>
> For instance, assume that the items in the lookup table I am interested
 have
> ID
> numbers of 20, 21, and 22, and the department number is 8765. Here's the
> SQL statement I thought I would need.
>
> select E.name,
> L.item
> from EmployeeTable E,
> LookupTable L
> where E.ssn = L.ssn(+)
> and and L.id between 20 and 22
> and E.dept = 8765;
>
>
> When I run this, it only gives me a list of those employees who have
 lookup
> items of 20, 21, and 22. It does not include those employees who do not
> have these items.
>
> Do I need to add something else to my outer join? Thanks.
>
>
> Dennis Hancy
> Eaton Corporation
> Cleveland, OH
>
> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the
 Web -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+
 groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email
abuse_at_newsone.net

    select E.name, L.item
> from EmployeeTable E,
> LookupTable L
> where E.ssn = L.ssn
> and L.id in(20,21,22)
> and E.dept = 8765;
>

--
Posted via CNET Help.com
http://www.help.com/
Received on Sat Mar 31 2001 - 21:30:08 CEST

Original text of this message