All,
I have been pulling my hair out with this query all day. What I want to do is select various records for an absence table. The criteria I am using are as follows. IF the end_date="" or the end > report_date AND AbsenceCode="SL". The first selection criteria work ok and it selects all the record that either has a null end_date or the end_date is greater than the report date. But when I add in the criteria for the absence type the query just seems to ignore the Code. Here is the SQL for my Query
all suggestions welcome
Simon
I have been pulling my hair out with this query all day. What I want to do is select various records for an absence table. The criteria I am using are as follows. IF the end_date="" or the end > report_date AND AbsenceCode="SL". The first selection criteria work ok and it selects all the record that either has a null end_date or the end_date is greater than the report date. But when I add in the criteria for the absence type the query just seems to ignore the Code. Here is the SQL for my Query
Code:
SELECT tblStaff_Absence.EIN, tblStaff_Absence.Absence_Code, tblStaff_Details.OUC, tblStaff_Details.Employer, tblStaff_Absence.Absence_Code, tblStaff_Absence.Absence_End, tblStaff_Absence.Absence_Start
FROM tblStaff_Details INNER JOIN tblStaff_Absence ON tblStaff_Details.EIN = tblStaff_Absence.EIN
WHERE (((tblStaff_Absence.Absence_Code)="al") AND ((IsNull([absence_end]))=True)) OR (((tblStaff_Absence.Absence_End)>[end_date]));
all suggestions welcome
Simon