解答
174
SQL文(クエリ)
SELECT COUNT(DISTINCT user_id) users FROM ( SELECT user_id , MAX(IF(product_id = 1, 1, 0)) AS product1_flag , MAX(IF(product_id = 2, 1, 0)) AS product2_flag FROM sample.sales GROUP BY user_id HAVING product1_flag > 0 AND product2_flag > 0 )