解答

178

SQL文(クエリ)

WITH master AS (
  SELECT
    user_id
    , order_id
    , product_id
    , COUNT(*) AS COUNT
  FROM
    sample.sales
  GROUP BY
    user_id
    , order_id
    , product_id
  HAVING COUNT > 1
)
SELECT
  user_id
  , name
FROM
  sample.customers
WHERE
  user_id IN(
    SELECT
      user_id
    FROM
      master
  )
ORDER BY
  user_id

結果テーブル

結果テーブル

サポートページに戻る