Left Outer Join - With Two conditions

V

Vadhimoo

Dear All,
Good morning, I need a Left outer Join with two conditions:
The records not in Dept table and CONDITIONS: (Emp.Name=Dept.Name AND
Emp.Age=Dept.Age)

For Example: I have two tables like below:


EMP Table:
Name Age Sex
a 12 m
b 13 f
c 14 m
d 15 f
e 16 m
f 17 f
g 18 m



DEPT Table:
Name Age Sex
a 12 m
b 20 f
e 16 m
g 19 m
h 22 f

Result/Output Is:
Emp.Name Emp.Age Emp.Sex
b 13 f
c 14 m
d 15 f
f 17 f
g 18 m



Thanks in advance for your reply.
Vadhimoo.
 
J

John Spencer

In SQL that query would look like:

SELECT EMP.*
FROM EMP LEFT JOIN DEPT
ON Emp.Name = Dept.Name
AND Emp.Age = Dept.Age
WHERE Dept.Name is Null


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top