title: List rows that have an ID in common in the same table with MySQL
body: <p>I'm building an activities website and I want to show on user's profiles the common activities I'm going to with this other user.</p>
  
  <p>So I have a table as follow :</p>
  
  <p><a href="https://i.stack.imgur.com/uezAV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uezAV.png" alt="enter image description here"></a></p>
  
  <p>Every time a user clicks "join" on an activity page, a new row is added to this table with :</p>
  
  <ul>
  <li>the user_id who joined</li>
  <li>the activity_id (event) attended</li>
  </ul>
  
  <p>So on each user's profile, I want to list the different activities we have in common.</p>
  
  <p>If the user's IDs are for example 1 and 10, then I can list the activities they go to with this query :</p>
  
  <pre><code>SELECT * FROM `activity_user` WHERE user_id IN(1, 10)
  </code></pre>
  
  <p>However, how to update this query to return only activities IDs they have in common?</p>