lbfeng
V2EX  ›  问与答

SQL 求谁没完成任务

  •  
  •   lbfeng · Mar 22, 2018 · 1437 views
    This topic created in 3018 days ago, the information mentioned may be changed or developed.

    学生和任务是多对多

    table1: students

    id name

    1 Li

    2 Wang

    3 Ming

    table2: mission_assignment(associate table)

    student_id misssion_id

    1 1

    1 2

    1 3

    2 2

    2 3

    3 1

    3 3

    table3: work_record

    student_id mission_id

    1 1

    1 2

    1 3

    2 2

    2 3

    3 1

    Li, Wang 完成了所有指定的任务,Ming 没有完成所有指定的任务。

    sql1 找出完成任务的所有人

    sql2 找出未完成任务的所有人

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   914 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:33 · PVG 06:33 · LAX 15:33 · JFK 18:33
    ♥ Do have faith in what you're doing.