这是我的数据
电影表:
id title
10 Promise Land
13 Alive
14 Bruce Almighty
15 Decay
19 Malcom X
用户表:
id username
1 Franck
2 Matt
存档表:
userid movieid
1 13
2 14
1 14
我想获取所有不在用户 id = 1 的存档表中的 movies.id、movies.title。我想使用 JOINS(我不想选择 select)
结果应该是:
id title
10 Promise Land
15 Decay
19 Malcom X
以下 SQL 失败:
SELECT a.id,a.title
FROM db.movies AS a
LEFT JOIN db.archive AS b ON a.id = b.movieid
LEFT JOIN db.users AS c ON c.id = b.userid
WHERE b.movieid IS NULL OR b.userid !=1;
谢谢