월별로 고용 상태를 파악하는 테이블이 있다고 가정 해 보겠습니다. 직원이 인턴으로 시작하여 학교에 다시 돌아가 전임으로 돌아온 시나리오가 있습니다.주간 스냅 샷으로 고용 기록 찾기
이상적으로 말하면, 나는 그/그녀의 고용 기록의 역사가 거의 완벽하다. 내가
SELECT
date_hire,
date_termination,
employee_id,
employee_type
FROM
employees
GROUP BY
date_hire,
date_termination,
employee_id,
employee_type
이 날을 반환 기술로 사용하여이 그룹을하고 시도
date_snapshot date_hire date_termination employee_id employee_type
2012_01_01 2012_01_01 null 10002 intern
2012_02_01 2012_01_01 null 10002 intern
2012_03_01 2012_01_01 2012_03_01 10002 intern
2012_04_01 2012_01_01 2012_03_01 10002 intern
2012_05_01 2012_05_01 null 10002 full-time
2012_06_01 2012_05_01 null 10002 full-time
2012_07_01 2012_05_01 null 10002 full-time
......
처럼
date_hire date_termination employee_id employee_type
2012_01_01 2012_03_01 10002 intern
2012_05_01 null 10002 full-time
데이터는 내가 한 원치 않는 기록
date_hire date_termination employee_id employee_type
2012_01_01 null 10002 intern
2012_01_01 2012_03_01 10002 intern
2012_05_01 null 10002 full-time
호환되지 않는 데이터베이스 태그를 제거했습니다. 실제로 사용중인 데이터베이스의 태그를 다시 추가하십시오. –