title: MySQL Query to find customers who have ordered two specific products
body: <p>I'm having trouble coming up with a query that will find all customers who have purchased both PROD1 and PROD2.</p>
  
  <p>Here's a pseudo-query that kind of looks like what I want to do: (obviously this wouldn't work)</p>
  
  <pre><code>SELECT COUNT(DISTINCT userid) 
    FROM TRANSACTIONS 
   WHERE product_id = 'prod1' 
     AND product_id = 'prod2'
  </code></pre>
  
  <p>So basically I'm trying to get a count of the number of distinct userids that have a transaction in the <code>transactions</code> table for both product_id '<code>prod1</code>' and '<code>prod2</code>'. Each transaction is stored in a row in the <code>transactions</code> table.</p>