title: List customers that have bought the same pair of products MySQL
body: <p>I have the following two tables:</p>
  
  <p><strong>customer</strong></p>
  
  <pre><code>id  | customer
  ----|---------
  1   | john
  2   | jenkins
  3   | jane
  4   | janet
  5   | jenny
  </code></pre>
  
  <p><strong>products</strong></p>
  
  <pre><code>customer_id | product | price
  ------------|-----------|-----
          1   | brush     | 3.5
          1   | deoderant | 1
          1   | soap      | 2.5
          2   | bread     | 3
          2   | brush     | 3
          2   | soap      | 2.5
          3   | brush     | 3
          4   | deoderant | 1
          4   | soap      | 1
          5   | milk      | 1
  </code></pre>
  
  <p>So I have to find the pair of customers that have bought the same product and I must remove the duplicate pairs and remove the pairs such as (john, john) for john. The MySQL query that I create is:</p>
  
  <p><strong>select A.customer, B.customer, products.customer_id, products.product  from customer A, customer B, products where
  B.id = products.customer_id and A.customer &lt;> B.customer group by B.customer;</strong></p>
  
  <p>I get the following resulted:</p>
  
  <pre><code>customer|customer|customer_id|product   
  --------|--------|-----------|--------
  john    | jane   | 3         | brush
  john    | janet  | 4         | deoderant
  john    | jenkins| 2         | bread
  john    | jenny  | 5         | milk
  jenkins | john   | 1         | brush
  </code></pre>
  
  <p>I have been battling with this the whole morning and am I am stuck. I know that it is wrong because jane and jenkins bought the same item.</p>