는 무료 (직원이 할당 된 작업없이 현재)입니다 직원MySQL의 쿼리는 무료로 직원
작업 테이블의 샘플 데이터를 나열하는 MySQL의 쿼리를 작성 도와주세요 찾을 수
emp_id task_start_date task_compeletion_date task_name
872 2014-06-03 17:14:44 2014-06-04 17:14:46 task1
873 2014-07-12 19:02:00 2014-07-13 00:25:00 task2
872 2014-12-03 13:09:08 2014-12-30 12:54:15 task7
874 2014-12-10 07:29:53 NULL task3
emp 테이블의 샘플 데이터
emp_id first_name last_name
872 John David
873 Suresh Kumar
874 Peter Nail
875 Zio Xing
나는이 쿼리를 생성
select * from emp where emp_id not in (select emp_id from task) union select emp.* from emp emp, task task where emp.emp_id = task.emp_id and (task.task_compeletion_date is not null or task.task_compeletion_date<now()) ;
,
하지만 그것은 IS NULL
조건 필요한 목록
'task_compeletion_date'는 emllee가 무료라는 것을 의미하는 NUll입니까? – Umair
작업 당 오직 한 명의 직원 만 있습니까? – Strawberry