Not sure what else to suggest, Nick.
Perhaps you could break the problem down into smaller chunks. Try the query
without crosstabbing or grouping:
SELECT HfL_AcuteIP_Detail.CSP,
HfL_AcuteIP_Detail.PbR,
HfL_ActFormat.Code AS HRG35
FROM HfL_ActFormat LEFT JOIN HfL_AcuteIP_Detail
ON HfL_ActFormat.Code = HfL_AcuteIP_Detail.HRG35
WHERE (HfL_AcuteIP_Detail.CSP="ENT")
Or (HfL_AcuteIP_Detail.CSP Is Null);
If that gives all the right results add teh GROUP BY clause.
Then try the crosstab without the IN in the PIVOT.
Hopefully you will be able to pin down the point at which it goes
pear-shaped. Is so, the solution might involve saving the query that works,
and then building on that.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
What criteria do you have? Did you explicitly ask for Nulls?
If you have criteria under a field from the outer side of the join, try
adding:
Or Is Null
messagenews:a6d15475-b183-4648-8e50-fcee6422cb8f@v56g2000hsf.googlegroups.com...
Thanks for attempting to resolve my problem Allen, but I am still at
somewhat of a loss to know what is going on. First of all, yes I did
have a criteria on the 'Many' side, and no I did not specifically ask
for any nulls. So when I saw your suggested resolution to my problem
I slapped my forehead and thought 'ah, of course'. However, when I
specifically asked for nulls as well as the row total only increased
by 30 to 100, rather then 610 which in the number of rows in the 'One'
side table.
Below is my SQL if it helps:
TRANSFORM Sum(HfL_AcuteIP_Detail.CountOfRUN_SEQ)
AS SumOfCountOfRUN_SEQ
SELECT HfL_AcuteIP_Detail.CSP,
HfL_AcuteIP_Detail.PbR,
HfL_ActFormat.Code AS HRG35
FROM HfL_ActFormat LEFT JOIN HfL_AcuteIP_Detail
ON HfL_ActFormat.Code = HfL_AcuteIP_Detail.HRG35
WHERE (HfL_AcuteIP_Detail.CSP="ENT")
Or (HfL_AcuteIP_Detail.CSP Is Null)
GROUP BY HfL_AcuteIP_Detail.CSP,
HfL_AcuteIP_Detail.PbR,
HfL_ActFormat.Code
ORDER BY HfL_AcuteIP_Detail.PbR DESC
PIVOT [pod] & " " & [Sex of patient] & " " & [FinalAgeBand]
IN ("ELORD Male 0-16","ELORD Male 17-39", ...- Hide quoted text -
- Show quoted text -