Table “argument_user”
+-------------+----------+
| argument | user_id |
+-------------+----------+
| bike | 1 |
| flower | 2 |
| web | 1 |
| web | 2 |
| nature | 1 |
| nature | 2 |
| nature | 3 |
+-------------+----------+
I want get ONLY the arguments in common with user 1 and 2 >> “web” (without “nature”)
+-------------+
| web |
+-------------+
Now I’m using this query, but it’s wrong because it returns me “web” and also “house”.
select argument from argument_user
where user_id in ('1','2')
group by argument having count(distinct(user_id)) = 2
+-------------+
| web |
| nature |
+-------------+
I thought to do a join with the same table, but i think it’s too heavy when the users will be more! don’t you?
So, something light to use with a lot of “user_id”.
Using a couple of JOINs