Intersection, Negative Keywords Missing in MySql, and Workarounds
- Internal registration and
- Subqueries or
- On the left, join accordingly.
Please read here
Executing INTERSECT and MINUS in MySQL
( SQL Server)
:
id_user id_movie
101 1
102 2
102 3
104 4
102 5
107 6
102 2
103 3
109 9
110 2
110 3
( SQL Server)
id_user
102
110
MySQL-
1 Inner join
select distinct a.id_user
from Rating a
join Rating b on a.id_user = b.id_user
where a.id_movie = 2 and b.id_movie = 3
2 Cross join
select distinct a.id_user
from Rating a, Rating b
where a.id_user = b.id_user
and a.id_movie = 2
and b.id_movie = 3
3
.