美文网首页
sql语句中 not exists 用法

sql语句中 not exists 用法

作者: 林太浪先生 | 来源:发表于2019-03-04 19:12 被阅读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)

    )

    相关文章

      网友评论

          本文标题:sql语句中 not exists 用法

          本文链接:https://www.haomeiwen.com/subject/xscwuqtx.html