Unmatched Query

R

Richardb

Michael,

That seems to work. What is the "T." do? Thanks

Michael Gramelspacher said:
Karl,

This is not working. Can I get additional help?

Richard

perhaps:

SELECT DmList.[DM Name]
FROM DmList
LEFT JOIN (SELECT *
FROM Communications
WHERE Communications.CommDate BETWEEN CVDATE([Start Date])
AND CVDATE([End Date])) AS T
ON DmList.[DM Name] = T.[District Mgr]
WHERE T.[District Mgr] IS NULL;
 
M

Michael Gramelspacher

Michael,

That seems to work. What is the "T." do? Thanks

Michael Gramelspacher said:
Karl,

This is not working. Can I get additional help?

Richard

perhaps:

SELECT DmList.[DM Name]
FROM DmList
LEFT JOIN (SELECT *
FROM Communications
WHERE Communications.CommDate BETWEEN CVDATE([Start Date])
AND CVDATE([End Date])) AS T
ON DmList.[DM Name] = T.[District Mgr]
WHERE T.[District Mgr] IS NULL;
The 'T' is an alias for the table subquery (derived table) used in place of a
table name.

I think the problem was that the WHERE clause on the joined table was making the
LEFT JOIN into an INNER JOIN. A LEFT JOIN only gets matches; you wanted the no
matches, which were no longer there after having been eliminated by the WHERE
clause on the null-supplying table.
 
R

Richardb

Thanks Michael I really appreciate your help.

Richard

Michael Gramelspacher said:
Michael,

That seems to work. What is the "T." do? Thanks

Michael Gramelspacher said:
On Fri, 14 Mar 2008 12:32:01 -0700, Richardb

Karl,

This is not working. Can I get additional help?

Richard

perhaps:

SELECT DmList.[DM Name]
FROM DmList
LEFT JOIN (SELECT *
FROM Communications
WHERE Communications.CommDate BETWEEN CVDATE([Start Date])
AND CVDATE([End Date])) AS T
ON DmList.[DM Name] = T.[District Mgr]
WHERE T.[District Mgr] IS NULL;
The 'T' is an alias for the table subquery (derived table) used in place of a
table name.

I think the problem was that the WHERE clause on the joined table was making the
LEFT JOIN into an INNER JOIN. A LEFT JOIN only gets matches; you wanted the no
matches, which were no longer there after having been eliminated by the WHERE
clause on the null-supplying table.
 

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