Stang70Fastback
Registered User.
- Local time
- Today, 03:15
- Joined
- Dec 24, 2012
- Messages
- 132
Hello everyone. I'll try to explain this intelligently. I need to generate a report that uses a Left Join query. The tables being joined are a "Projects" table and an "Assignments" table. The Projects table, as one might expect, has one entry for each project being worked on. The Assignments table has many entries for each Project, each entry for a different engineer assigned to the Project.
What I'm trying to do is create a report as a continuous form, that lists every project. Not too hard. The tricky part is that for each project, I want it to show the "Design Lead" for each project. In other words, one of the engineers in the "Assignments" table is designated as the design lead for that project.
Initially I thought that would be easy. In my left-join statement, my where clause simply has a statement that tells it to exclude any records where the design lead isn't "true." This kind of worked, except some projects don't have a design lead, so now those projects don't show up at all.
So what I'm looking for is the following: How do design a query that will give me only ONE entry for each project, and for each one of those entries, have a design lead, or have it blank if there isn't one (or if there aren't any employees assigned to the project at all)?
This is the current query, which you can see will exclude any projects without a design lead, which is a problem:
What I'm trying to do is create a report as a continuous form, that lists every project. Not too hard. The tricky part is that for each project, I want it to show the "Design Lead" for each project. In other words, one of the engineers in the "Assignments" table is designated as the design lead for that project.
Initially I thought that would be easy. In my left-join statement, my where clause simply has a statement that tells it to exclude any records where the design lead isn't "true." This kind of worked, except some projects don't have a design lead, so now those projects don't show up at all.
So what I'm looking for is the following: How do design a query that will give me only ONE entry for each project, and for each one of those entries, have a design lead, or have it blank if there isn't one (or if there aren't any employees assigned to the project at all)?
This is the current query, which you can see will exclude any projects without a design lead, which is a problem:
Code:
SELECT Assignments.ProjectNum AS Assignments_ProjectNum, Assignments.Badge, Assignments.LastName, Assignments.FirstName, Assignments.DLead, Projects.JOCNum, Projects.ProjectNum AS Projects_ProjectNum, Projects.CapitalNum1, Projects.CapitalNum2, Projects.ProjectName, Projects.Type, Projects.DStartDate, Projects.CStartDate, Projects.DEndDate, Projects.CEndDate
FROM Projects LEFT JOIN Assignments ON Projects.[ProjectNum] = Assignments.[ProjectNum]
WHERE (Assignments.DLead<>False Or IsNull(Assignments.Badge)) AND (Projects.Type)=Forms!MAINWINDOW!TypeCOM;