
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '31 May 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'31 May 2023','Sick','06 Jun 2023', 0,1,0,1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '17 May 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'17 May 2023','Sick','17 May 2023', 0,1,0,1)
