lbfeng
V2EX  ›  问与答

SQL 求谁没完成任务

  •  
  •   lbfeng · Mar 22, 2018 · 1327 views
    This topic created in 2974 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   ·   1811 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 16:19 · PVG 00:19 · LAX 09:19 · JFK 12:19
    ♥ Do have faith in what you're doing.