J
JimS
I have a query -- massively large, several layers deep, but still
straightforward. It works fine by gathering 5 different types of spending
summed up by project and equipment. As I said, it works fine.
My client says "I forgot the sixth" type of spending. No big deal, it's in
an excel table (like many of the other ones) you can import and hold for
reporting. Like several of the others, I set up a simple import, and "made" a
table in access to hold the imported data. I've used that table many times
for other purposes, just fine.
When I went to add this table to the massive composite query (using a query
to translate a text "Project Nbr" to a "ProjectID", and setting the other key
field "MICAPID" to zero), I put the table in the query in a left join --
meaning it would contribute to the massive query, but not constrain it.
Here's the little query:
SELECT CLng(tblProjects.ID) AS ProjectID, CLng(0) AS MICAPID, CLng(40) AS
DisciplineID, Round([PCARD],2) AS PCardSpend
FROM AllPCardImport INNER JOIN tblProjects ON AllPCardImport.[PROJ #] =
tblProjects.ProjectNbr;
When I joined this query to the massive query, in exactly the same way I
joined the other 5 or so subqueries, its results were exactly as if I'd
joined it in an inner join.
After much experimentation, I found that if I took the original massive
composite query and turned it into a flat table, then joined this query to it
(using a left join), I got the same result (hence why I don't include the
massive query here).
But, if I then turned this query into a flat table and joined it to the
massive query, it works JUST FINE. It populates the PCard Spending Column and
properly includes all records from the massive query, even if there are no
matching keys.
Obviously, I have a workaround, but does anyone have any idea why this
behavior is happening?
straightforward. It works fine by gathering 5 different types of spending
summed up by project and equipment. As I said, it works fine.
My client says "I forgot the sixth" type of spending. No big deal, it's in
an excel table (like many of the other ones) you can import and hold for
reporting. Like several of the others, I set up a simple import, and "made" a
table in access to hold the imported data. I've used that table many times
for other purposes, just fine.
When I went to add this table to the massive composite query (using a query
to translate a text "Project Nbr" to a "ProjectID", and setting the other key
field "MICAPID" to zero), I put the table in the query in a left join --
meaning it would contribute to the massive query, but not constrain it.
Here's the little query:
SELECT CLng(tblProjects.ID) AS ProjectID, CLng(0) AS MICAPID, CLng(40) AS
DisciplineID, Round([PCARD],2) AS PCardSpend
FROM AllPCardImport INNER JOIN tblProjects ON AllPCardImport.[PROJ #] =
tblProjects.ProjectNbr;
When I joined this query to the massive query, in exactly the same way I
joined the other 5 or so subqueries, its results were exactly as if I'd
joined it in an inner join.
After much experimentation, I found that if I took the original massive
composite query and turned it into a flat table, then joined this query to it
(using a left join), I got the same result (hence why I don't include the
massive query here).
But, if I then turned this query into a flat table and joined it to the
massive query, it works JUST FINE. It populates the PCard Spending Column and
properly includes all records from the massive query, even if there are no
matching keys.
Obviously, I have a workaround, but does anyone have any idea why this
behavior is happening?