我需要找出其他人在给定的日期范围内申请休假。我这样想(PostgreSQL)
SELECT
hel.hrl_id,
hry_type,
hep.emp_id,
hep.emp_code,
hep.emp_firstname || ' ' || hep.emp_lastname AS NAME,
hel.hrl_date_from,
hel.hrl_date_to,
hel.hrl_no_of_leave,
hel.hrl_note,
hel.hrl_applied_date,
dep_name
FROM
hr_emp_personal hep
LEFT JOIN hr_emp_official heo ON hep.emp_id = heo.emp_id
LEFT JOIN hr_emp_leave hel ON hep.emp_id = hel.emp_id
LEFT JOIN department_master dep ON heo.hro_department = dep.dep_id
LEFT JOIN hr_yearlyleavemaster hry ON hry.hry_id = hel.hry_id
WHERE
hep.emp_left = 0
AND hel.hrl_incharge_approve = 1
AND hel.hrl_hr_approve = 1
AND hel.hrl_date_to > CURRENT_DATE
AND hrl_date_from <= '2015-10-23'
AND hrl_date_to > '2015-10-26'
我在数据库中有一个从24-10-2015
到27-10-2015
的记录。我怎样才能做到这一点?员工需要知道在给定范围内还有谁请假。