Active Headcount on a Date
Medium
HR Analytics
Return the number of employees who were employed on 2026-06-30: hired on or before that date and either still employed or leaving after it.
Table schema
Employees(id INT PRIMARY KEY, hire_date DATE, leave_date DATE NULL)Sample data
id | hire_date | leave_date
1 | 2020-01-01 | NULL
2 | 2025-03-01 | 2026-05-01
3 | 2026-02-01 | NULL
4 | 2026-07-01 | NULL
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.