title: How to find the pairs of users that have bough the same product?
body: <p>An online shop has three tables: User, Item, Buys.
  Buys combines the IDs of User(s) and Item(s) they have purchased:</p>
  <p>User:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>John</td>
  </tr>
  <tr>
  <td>2</td>
  <td>Emma</td>
  </tr>
  <tr>
  <td>3</td>
  <td>Carl</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Item:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Description</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>10</td>
  <td>Ball</td>
  </tr>
  <tr>
  <td>20</td>
  <td>Guitar</td>
  </tr>
  <tr>
  <td>30</td>
  <td>Book</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Buys:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>User</th>
  <th>Item</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>10</td>
  </tr>
  <tr>
  <td>2</td>
  <td>20</td>
  </tr>
  <tr>
  <td>3</td>
  <td>20</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I have to come up with a query that lists, in two columns, paired names of Users that bought the same Item. It sounded simple at first but as of now I've been on this for almost three hours.</p>
  <p><strong>Expected result:</strong></p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>User 1</th>
  <th>User 2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2</td>
  <td>3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>This is what I got at the moment:</p>
  <pre><code>SELECT U1.name AS 'User 1', U2.name **AS** 'User 2'
  FROM User U1, User U2
  JOIN Buys B1 ON B1.user = id
  JOIN Buys B2 ON B2.user = U2.id
  WHERE** B1.item = B2.item 
  </code></pre>
  <p>I tried other ways using subqueries, however it was a bit too confusing so I will not post that.</p>