sql语句中 not exists 用法
2019-03-04 本文已影响0人
林太浪先生
select person_name
from tb_person
where notexists (select
o.s_id,
p1.person_name,
p1.person_id,
p2.person_name,
t.create_time,
t.name
from tb_task t left join tb_person p1 on t.creator_id = p1.person_id left join tb_person p2 on t.responsible_person_id = p2.person_id left join tb_organization o on p1.organization_id = o.s_id
//务必创建二表之间的关联
where t.deleted=0 and p2.person_name = tb_person.person_name and t.creator_id != 'system' and t.plan_start_time<= CAST(#{startTime} AS TIMESTAMP) and t.plan_end_time>= CAST(#{endTime} AS TIMESTAMP)
and t.create_time>= CAST(#{deadLine} AS TIMESTAMP)
)