V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lbfeng
V2EX  ›  问与答

SQL 求谁没完成任务

  •  
  •   lbfeng · Mar 22, 2018 · 1309 views
    This topic created in 2969 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   ·   967 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:18 · PVG 05:18 · LAX 14:18 · JFK 17:18
    ♥ Do have faith in what you're doing.