Outer Join

From: <dennishancy_at_eaton.com>
Date: 30 Mar 2001 18:46:51 GMT
Message-ID: <9a2kar$iuf$1_at_news.netmar.com>


[Quoted] 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 [Quoted] 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
[Quoted] 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
[Quoted]    and E.dept = 8765;

When I run this, it only gives me a list of those employees who have lookup [Quoted] 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
Received on Fri Mar 30 2001 - 20:46:51 CEST

Original text of this message