John,
I realize that I've used the wrong query for the SQL below, although I think the issue is the same. The query I provided earlier was actually qProjectNeed, which is used in the form where projects are assigned to needs.
Ultimately, however, I believe it is the same issue, with additional selected fields for the report.
The SQL for the report is the following:
SELECT Projects.ID AS Projects_ID, Projects.Hide, Projects.[Project Number], Projects.[Project Low], Projects.[Project High], Projects.[Estimated Downtime], Projects.[Action Year], Projects.Rec, Projects.[Project Desc], Projects.[Related Projects], Projects.[Related Projects].Value, Projects.[Proj Full Descript], Projects.[Proj Priority], [Needs and Recommendations].[Stated Need], [Needs and Recommendations].Recommendation, [Needs and Recommendations].ID AS [Needs and Recommendations_ID], [Needs and Recommendations].Priority, [Needs and Recommendations].[Work By], [Needs and Recommendations].Photo1, [Needs and Recommendations].Photo2, [Needs and Recommendations].Comment, [Needs and Recommendations].[System Primary], [Needs and Recommendations].[System Other], [Needs and Recommendations].[System Other].Value
FROM Projects INNER JOIN ([Needs and Recommendations] INNER JOIN tProjectNeed ON [Needs and Recommendations].ID = tProjectNeed.NeedID) ON Projects.ID = tProjectNeed.ProjectID;
Not every Need has a Project, there are Projects with multiple Needs. There may be some Projects without Needs. (I didn't do the data entry on this one, so I'd need to dig a little to confirm.)
So, I took the above SQL and revised it to:
SELECT...
FROM Projects LEFT JOIN ([Needs and Recommendations] RIGHT JOIN tProjectNeed ON [Needs and Recommendations].ID = tProjectNeed.NeedID) ON Projects.ID = tProjectNeed.ProjectID;
Now the query reports all projects! And, the report, of course, is also now showing the appropriate data.
Thanks for the help!
So that I understand:
What does changing the joins in this fashion mean? Should I be keeping my eye out for missing Needs, since changing the join to LEFT JOIN for this table?
-Kacy
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
John Viescas, author
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
I realize that I've used the wrong query for the SQL below, although I think the issue is the same. The query I provided earlier was actually qProjectNeed, which is used in the form where projects are assigned to needs.
Ultimately, however, I believe it is the same issue, with additional selected fields for the report.
The SQL for the report is the following:
SELECT Projects.ID AS Projects_ID, Projects.Hide, Projects.[Project Number], Projects.[Project Low], Projects.[Project High], Projects.[Estimated Downtime], Projects.[Action Year], Projects.Rec, Projects.[Project Desc], Projects.[Related Projects], Projects.[Related Projects].Value, Projects.[Proj Full Descript], Projects.[Proj Priority], [Needs and Recommendations].[Stated Need], [Needs and Recommendations].Recommendation, [Needs and Recommendations].ID AS [Needs and Recommendations_ID], [Needs and Recommendations].Priority, [Needs and Recommendations].[Work By], [Needs and Recommendations].Photo1, [Needs and Recommendations].Photo2, [Needs and Recommendations].Comment, [Needs and Recommendations].[System Primary], [Needs and Recommendations].[System Other], [Needs and Recommendations].[System Other].Value
FROM Projects INNER JOIN ([Needs and Recommendations] INNER JOIN tProjectNeed ON [Needs and Recommendations].ID = tProjectNeed.NeedID) ON Projects.ID = tProjectNeed.ProjectID;
Not every Need has a Project, there are Projects with multiple Needs. There may be some Projects without Needs. (I didn't do the data entry on this one, so I'd need to dig a little to confirm.)
So, I took the above SQL and revised it to:
SELECT...
FROM Projects LEFT JOIN ([Needs and Recommendations] RIGHT JOIN tProjectNeed ON [Needs and Recommendations].ID = tProjectNeed.NeedID) ON Projects.ID = tProjectNeed.ProjectID;
Now the query reports all projects! And, the report, of course, is also now showing the appropriate data.
Thanks for the help!
So that I understand:
What does changing the joins in this fashion mean? Should I be keeping my eye out for missing Needs, since changing the join to LEFT JOIN for this table?
-Kacy
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
Kacy-
Ah, looks like you need a LEFT JOIN from Projects to tProjectNeed. There must be some Projects that have no matching record in the needs table.
John Viescas, author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Access Applications
On Sep 9, 2016, at 02:26, theaterkacy <no_reply@yahoogroups.com> wrote:
John,
Thanks for the reply.
SELECT tProjectNeed.ProjectID, Projects.[Project Number], Projects.[Project Desc], tProjectNeed.NeedID, tProjectNeed.ID
FROM Projects INNER JOIN tProjectNeed ON Projects.[ID] = tProjectNeed.[ProjectID];
What would you like to know about the tables?
My apologies for not including the prior conversation in my last post. I thought I had, but I'm having a bear of a time using Yahoo groups on my mobile device.
-Kacy
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
Kacy-
It would help to see the SQL of your query and the structure of your tables.
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
__._,_.___
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (7) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar