Left Join not returning all records

Perissos

Registered User.
Local time
Today, 14:23
Joined
Jun 28, 2010
Messages
61
This is the select statement from a (what I thought was simple) query. I have a table tblLogistics that I want to see all records from. I know that some of the lines will be blank from the other table because they don't all have the data I am looking for. I thought if I joined with a left join it would show all the records from the tbllogistics. Am I looking at this wrong?

SELECT tblLogistics.Sort, tblLogistics.[Type-2], tblLogCosts.Actual, tblLogCosts.AOP
FROM tblLogistics LEFT JOIN tblLogCosts ON tblLogistics.Desc = tblLogCosts.Desc
GROUP BY tblLogistics.Sort, tblLogistics.[Type-2], tblLogistics.Country, tblLogCosts.Actual, tblLogCosts.AOP, tblLogCosts.FYPeriod, tblLogCosts.FYYear
HAVING (((tblLogistics.Country)="Venezuela IMC") AND ((tblLogCosts.FYPeriod)=6) AND ((tblLogCosts.FYYear)=2010))
ORDER BY tblLogistics.Sort;
 
Given that you're not using any aggregate functions, I would get rid of the GROUP BY clause and change the HAVING clause to a WHERE clause. Somewhere in the back of my mind is the thought that a totals query can do odd things to a LEFT JOIN.
 
Got it, thank you.

And nah baldy.. it's me. I don't think I have ever put 5 subreports into 1 report before and I am trying to find an easier way of doing it. So I am messing around trying to come up with different ideas.
 

Users who are viewing this thread

Back
Top Bottom