Okay, the subgroup table has been updated to include not only the monthno but also the year to allow for future growth. The problem is that if I do a RIGHT JOIN of the below, no change:
SELECT Subgroup.SubGroup, Subgroup.Monthno, Subgroup.FY, CPGroupSummary1.SubGroup, CPGroupSummary1.FiscalYear, CPGroupSummary1.MonthNumber, CPGroupSummary1.MonthID, CPGroupSummary1.BroadGroup, CPGroupSummary1.[SumOfGross SQFT], CPGroupSummary1.[SumOfReject SQFT], IIf([SumOfGross SQFT]=0,0,[SumOfReject SQFT]/[SumOfGross SQFT]) AS RejectPercentSQFT, CPGroupSummary1.[SumOfNet SQFT], CPGroupSummary1.[SumOfGross STDF], CPGroupSummary1.[SumOfReject STDF], CPGroupSummary1.[SumOfNet STDF], IIf([SumOfGross STDF]=0,0,[SumOfReject STDF]/[SumOfGross STDF]) AS RejectPercentSTDF, CPGroupSummary1.SumOfNetRuntime, CPGroupSummary1.SumOfUnschedDelay, CPGroupSummary1.SumOfSchedDelay, CPGroupSummary1.SumOfNonAvail, IIf([SumOfGross SQFT]=0,0,[SumOfNet SQFT]/[SumOfDesignSQFT]) AS MAD, [SumOfNetRuntime]+[SumOfUnschedDelay]+[SumOfSchedDelay] AS TotalTime, IIf([SumOfUnschedDelay]=0,0,[SumOfUnschedDelay]/[TotalTime]) AS UnschedPercent, IIf([SumOfSchedDelay]=0,0,[SumOfSchedDelay]/[TotalTime]) AS SchedPercent, IIf(([SumOfUnschedDelay]+[SumOfSchedDelay])=0,0,([SumOfUnschedDelay]+[SumOfSchedDelay])/[TotalTime]) AS TotalDelayPercent, CPGroupSummary1.SumOfDesignSQFT, CPGroupSummary1.PickSize, IIf(CPGroupsummary1.subgroup="Scheduled Time",0,((([SumOfGross SQFT]/[SumOfNettimeM])/60)*1)/[PickSize]) AS PPM, CPGroupSummary1.SumOfNettimeM
FROM Subgroup RIGHT JOIN CPGroupSummary1 ON (Subgroup.SubGroup = CPGroupSummary1.SubGroup) AND (Subgroup.Monthno = CPGroupSummary1.MonthNumber) AND (Subgroup.FY = CPGroupSummary1.FiscalYear);
Now, if I do a LEFT JOIN (below) the missing subgroups appear but no month number appears therefore it does not group properly on the report:
SELECT Subgroup.SubGroup, Subgroup.Monthno, Subgroup.FY, CPGroupSummary1.SubGroup, CPGroupSummary1.FiscalYear, CPGroupSummary1.MonthNumber, CPGroupSummary1.MonthID, CPGroupSummary1.BroadGroup, CPGroupSummary1.[SumOfGross SQFT], CPGroupSummary1.[SumOfReject SQFT], IIf([SumOfGross SQFT]=0,0,[SumOfReject SQFT]/[SumOfGross SQFT]) AS RejectPercentSQFT, CPGroupSummary1.[SumOfNet SQFT], CPGroupSummary1.[SumOfGross STDF], CPGroupSummary1.[SumOfReject STDF], CPGroupSummary1.[SumOfNet STDF], IIf([SumOfGross STDF]=0,0,[SumOfReject STDF]/[SumOfGross STDF]) AS RejectPercentSTDF, CPGroupSummary1.SumOfNetRuntime, CPGroupSummary1.SumOfUnschedDelay, CPGroupSummary1.SumOfSchedDelay, CPGroupSummary1.SumOfNonAvail, IIf([SumOfGross SQFT]=0,0,[SumOfNet SQFT]/[SumOfDesignSQFT]) AS MAD, [SumOfNetRuntime]+[SumOfUnschedDelay]+[SumOfSchedDelay] AS TotalTime, IIf([SumOfUnschedDelay]=0,0,[SumOfUnschedDelay]/[TotalTime]) AS UnschedPercent, IIf([SumOfSchedDelay]=0,0,[SumOfSchedDelay]/[TotalTime]) AS SchedPercent, IIf(([SumOfUnschedDelay]+[SumOfSchedDelay])=0,0,([SumOfUnschedDelay]+[SumOfSchedDelay])/[TotalTime]) AS TotalDelayPercent, CPGroupSummary1.SumOfDesignSQFT, CPGroupSummary1.PickSize, IIf(CPGroupsummary1.subgroup="Scheduled Time",0,((([SumOfGross SQFT]/[SumOfNettimeM])/60)*1)/[PickSize]) AS PPM, CPGroupSummary1.SumOfNettimeM
FROM Subgroup LEFT JOIN CPGroupSummary1 ON (Subgroup.SubGroup = CPGroupSummary1.SubGroup) AND (Subgroup.Monthno = CPGroupSummary1.MonthNumber) AND (Subgroup.FY = CPGroupSummary1.FiscalYear);
Any ideas or thoughts as to where I went wrong?