I'm stumped! Trying to return all offices from the [tbl OFFICE DATA] table for Mgr. 0, for all three of the F2B, F4, and OTHER categories, even if null.
No matter what I try, I can't get the results I want. Below is SQL code.
SELECT [tbl OFFICE DATA].[FINANCE NO], [tbl OFFICE DATA].OFFICE, [tbl OFFICE DATA].MGR, [tbl ACTL DATA].YRWK, IIf([LDC]='2000' Or [LDC]='2100' Or [LDC]='2200','F2B',IIf([LDC]='4000' Or [LDC]='4100' Or [LDC]='4200','F4','OTHER')) AS FUNCTION, Nz(Sum([WK HRS]),0) AS WKHRS, Nz(Sum([OT HRS]),0) AS OTHRS
FROM [tbl ACTL DATA] RIGHT JOIN [tbl OFFICE DATA] ON [tbl ACTL DATA].[FINANCE NO] = [tbl OFFICE DATA].[FINANCE NO]
GROUP BY [tbl OFFICE DATA].[FINANCE NO], [tbl OFFICE DATA].OFFICE, [tbl OFFICE DATA].MGR, [tbl ACTL DATA].YRWK, IIf([LDC]='2000' Or [LDC]='2100' Or [LDC]='2200','F2B',IIf([LDC]='4000' Or [LDC]='4100' Or [LDC]='4200','F4','OTHER'))
HAVING ((([tbl OFFICE DATA].MGR)='0'));
Thanks.
No matter what I try, I can't get the results I want. Below is SQL code.
SELECT [tbl OFFICE DATA].[FINANCE NO], [tbl OFFICE DATA].OFFICE, [tbl OFFICE DATA].MGR, [tbl ACTL DATA].YRWK, IIf([LDC]='2000' Or [LDC]='2100' Or [LDC]='2200','F2B',IIf([LDC]='4000' Or [LDC]='4100' Or [LDC]='4200','F4','OTHER')) AS FUNCTION, Nz(Sum([WK HRS]),0) AS WKHRS, Nz(Sum([OT HRS]),0) AS OTHRS
FROM [tbl ACTL DATA] RIGHT JOIN [tbl OFFICE DATA] ON [tbl ACTL DATA].[FINANCE NO] = [tbl OFFICE DATA].[FINANCE NO]
GROUP BY [tbl OFFICE DATA].[FINANCE NO], [tbl OFFICE DATA].OFFICE, [tbl OFFICE DATA].MGR, [tbl ACTL DATA].YRWK, IIf([LDC]='2000' Or [LDC]='2100' Or [LDC]='2200','F2B',IIf([LDC]='4000' Or [LDC]='4100' Or [LDC]='4200','F4','OTHER'))
HAVING ((([tbl OFFICE DATA].MGR)='0'));
Thanks.