Join two tables date from first in range of dates from second

前端 未结 3 1288
离开以前
离开以前 2021-01-19 19:18

I have two tables like below (date format: yyyy-MM-dd):
1) Table1 - EMPLOYEE_OVERTIMES (alias: EO)

EMPLOYEE_ID | OVERTIME_DATE
--------------------         


        
3条回答
  •  不思量自难忘°
    2021-01-19 19:44

    Would this work?

    SELECT
      EO.Employee_ID,
      EH.Start_Date,
      EH.End_Date,
      EO.OverTime_Date
    FROM
      EMPLOYEE_OVERTIMES EO INNER JOIN
      EMPLOYEE_HOLIDAYS EH ON EO.Employee_ID = EH.Employee_ID
    WHERE
      EO.Overtime_Date BETWEEN EH.Start_date and EH.End_Date
    

提交回复
热议问题