Oracle 11gR2
RHEL 6.4
---------------
Given the following table data:
EMPLOYEE HIRE_DATE TERM_DATE DEPT
------------------ ----------------- ------------------ ---------
John Doe 01/01/13 101
Jane Smith 01/05/13 102
Bob Jones 02/04/13 04/22/13 102
Jenny Boo 03/12/13 03/31/13 103
Joe Schmoe 03/24/13 102
Bill Max 04/23/13 103
Jill Clay 04/24/13 103
Joe Boom 05/11/13 102
I want to return the number of employees that are still employed for each month so long as they were hired anytime in that month and irregardless if they were terminated later that month (i.e only the month concerns me). So I would be expecting
MONTH EMPLOYEES
Jan 2
Feb 3
Mar 5
Apr 6 (Jenny Boo has been terminated)
May 6 (Jenny Boo and Bob Jones have been terminated)
I know there are some bright people out there that are SQL experts but I am not one of them. If there is a way to do this in just SQL I would like to see it.