MYSQL - Select only if row in LEFT JOIN is not present

前端 未结 2 539
一个人的身影
一个人的身影 2021-01-07 20:19

I have 2 simple mysql tables. The first 1 called mail and has 2 rows:

sender | receiver
Marley | Bob 
Saget  | Bob 

The second one called b

2条回答
  •  醉话见心
    2021-01-07 20:33

    Try this:

    SELECT sender
    FROM mail m
    WHERE NOT EXISTS (SELECT 1 FROM block 
                      WHERE blocker = m.receiver 
                      AND blocked = m.sender)
    

提交回复
热议问题