I have 3 tables.
Table1(Members): MemberID, MemberName, GroupID
Table2(Log):LogID, MemberID, PeriodID
Table3(Periods): PeriodID, FromDate, ToDate
I want to select members from table1 which don't have logs in table2 for certain PeriodID(table3)
My code is
SELECT * FROM Members m
LEFT JOIN Log pl
ON m.MEMBER_ID= pl.MEMBER_ID
WHERE m.GroupID='2' AND l.PayrollLogID is null
This returns members don't have logs in Table2 for all PeriodIDs. I just don't know how to pull members don't have logs for certain PeriodIDs. Any help will be highly appreciated. Thanks!
Table1(Members): MemberID, MemberName, GroupID
Table2(Log):LogID, MemberID, PeriodID
Table3(Periods): PeriodID, FromDate, ToDate
I want to select members from table1 which don't have logs in table2 for certain PeriodID(table3)
My code is
SELECT * FROM Members m
LEFT JOIN Log pl
ON m.MEMBER_ID= pl.MEMBER_ID
WHERE m.GroupID='2' AND l.PayrollLogID is null
This returns members don't have logs in Table2 for all PeriodIDs. I just don't know how to pull members don't have logs for certain PeriodIDs. Any help will be highly appreciated. Thanks!