find all time codes used on unit between certain dates that the unit does not normally have access to (most likely floated for a time code that does not exist), which causes a break in the units schedule said employee was floated to.
/* find all time codes used on unit between certain dates that the unit does
* not normally have access to (most likely floated for a time code that does
* not exist), which causes a break in the units schedule said employee was
* floated to.*/
DEFINE startDate = '13-AUG-15 00:00:00'
DEFINE ENDDATE = '15-AUG-15 23:59:59'
DEFINE unitID = 'W5'
SELECT employee_id, end_dttm, time_code
FROM employee_times
WHERE END_DTTM >= '&startDate'
AND END_DTTM <= '&endDate'
AND UNIT_ID = '&unitID'
AND time_code NOT IN
(
SELECT DISTINCT time_code
FROM unit_times
WHERE UNIT_ID = '&unitID'
);