获取在特定日期范围内活跃的员工 [英] Get employees that were active during specific date range
本文介绍了获取在特定日期范围内活跃的员工的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取在特定日期范围内(2014年1月1日至2014年3月31日)活跃的在职员工列表
How do I get list of active employees who were active in a specific date range (1-JAN-2014 TO 31-MAR-2014)
我的桌子就像 桌子: 员工头
My table is like Table: employeeheader
- empid
- 名字
- 姓氏
历史
- empid
- 开始日期
- 结束日期
如果enddate为null,则表示该员工仍在工作.
If enddate is null that means employee is still active.
推荐答案
SELECT * FROM employeeheader
JOIN emphistory ON employeeheader.empid = emphistory.empid
WHERE begindate <= <range_start> AND (enddate is null OR enddate >= <range_end>)
这为在特定范围内完全工作的所有员工提供了帮助.
This gives all the employees which worked completely during a specific range.
这篇关于获取在特定日期范围内活跃的员工的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文