title: Total Count of Active Employees by Date
body: <p>I have in the past written queries that give me counts by date (hires, terminations, etc...) as follows:</p>
  
  <pre><code>SELECT per.date_start AS "Date",
    COUNT(peo.EMPLOYEE_NUMBER) AS "Hires"
  
  FROM hr.per_all_people_f peo,
    hr.per_periods_of_service per
  
  WHERE per.date_start BETWEEN peo.effective_start_date AND peo.EFFECTIVE_END_DATE
  
  AND per.date_start BETWEEN :PerStart AND :PerEnd
  
  AND per.person_id = peo.person_id
  
  GROUP BY per.date_start
  </code></pre>
  
  <p>I was now looking to create a count of active employees by date, however I am not sure how I would date the query as I use a range to determine active as such:</p>
  
  <pre><code>SELECT COUNT(peo.EMPLOYEE_NUMBER) AS "CT"
  
  FROM hr.per_all_people_f peo
  
  WHERE peo.current_employee_flag = 'Y'
  
  and TRUNC(sysdate) BETWEEN peo.effective_start_date AND peo.EFFECTIVE_END_DATE
  </code></pre>