N
N L
Greetings,
I have one table, and a few queries that I want to run off of that
table. I would also like to view the results of LEFT JOIN operations
on those queries, and do it in a single SELECT statement. It isn't
practical for me to create and maintain a bunch of stored queries that
I can join.
I have figured out that I can put subqueries within parentheses in my
FROM clause, but then I can't figure out how to refer to the field on
which to join in the ON clause.
It looks like some other SQLs include a WITH statement, allowing
referrals to subqueries. Does Access have anything like that?
Here's what I have:
SELECT Employee_Table.*
FROM
(SELECT Employee_Table.*
FROM Employee_Table
WHERE (Employee_Table.Date)="January")
LEFT JOIN
(SELECT Employee_Table.*
FROM Employee_Table
WHERE (Employee_Table.Date)="February")
ON ??Subquery A??.[EMPLOYEE ID]=??Subquery B??.[EMPLOYEE ID]
WHERE ??Subquery A??.[EMPLOYEE ID]) Is Null;
The idea is that I want to find employees who joined in February. I
don't, however, know what to replace "??Subquery A??" and "??Subquery
B??" with.
I know for this example I can do a WHERE NOT IN, but I'd like to know
how to do this specifically.
Thanks,
N Lee
I have one table, and a few queries that I want to run off of that
table. I would also like to view the results of LEFT JOIN operations
on those queries, and do it in a single SELECT statement. It isn't
practical for me to create and maintain a bunch of stored queries that
I can join.
I have figured out that I can put subqueries within parentheses in my
FROM clause, but then I can't figure out how to refer to the field on
which to join in the ON clause.
It looks like some other SQLs include a WITH statement, allowing
referrals to subqueries. Does Access have anything like that?
Here's what I have:
SELECT Employee_Table.*
FROM
(SELECT Employee_Table.*
FROM Employee_Table
WHERE (Employee_Table.Date)="January")
LEFT JOIN
(SELECT Employee_Table.*
FROM Employee_Table
WHERE (Employee_Table.Date)="February")
ON ??Subquery A??.[EMPLOYEE ID]=??Subquery B??.[EMPLOYEE ID]
WHERE ??Subquery A??.[EMPLOYEE ID]) Is Null;
The idea is that I want to find employees who joined in February. I
don't, however, know what to replace "??Subquery A??" and "??Subquery
B??" with.
I know for this example I can do a WHERE NOT IN, but I'd like to know
how to do this specifically.
Thanks,
N Lee