HII have a stored Procedure listed belowI want to select records from attendance Table joined on employee if record for some employee is missing then select them as absant it works fine for single date but when i change Where clause to between dates it select only few records that are present in AttendanceRecords tablePlease Help mealter proc att_AttendanceReport@Date1 datetime =NULL,@Date2 datetime =NULLASif @Date1 IS NULLSelect @Date1=GETDATE()If @Date2 IS NULLSet @Date2=Getdate() Select CONVERT(VARCHAR(11),(isnull(ar.RecordDate,GETDATE())),120) AS 'Record Date',E.EmployeeNumber,e.EmployeeName,ar.Arrival,ar.Departure, s.StatusName from Employees e left outer join EmployeeAttendanceRecords ar on ar.employeeid=e.EmployeeIDinner join AttendanceStatus s on isnull(ar.AttendanceStatusID,2)=s.StatusIDwhere RecordDate between @Date1 AND @Date2 OR RecordDate IS NULL
Rashed