解答

188

SQL文(クエリ)

WITH master AS (
  SELECT
    cid
    , session_count
    , MAX(cv_page) AS cv
  FROM
    (
      SELECT
        *
        , IF(page = "/thank_you/", 1, 0) AS cv_page
      FROM
        sample.web_log
    )
  GROUP BY
    cid
    , session_count
)
SELECT
  cv_count
  , COUNT(DISTINCT cid) AS users
FROM
  (
    SELECT
      cid
      , SUM(cv) AS cv_count
    FROM
      master
    GROUP BY
      cid
  )
GROUP BY
  cv_count
ORDER BY
  cv_count DESC

結果テーブル

結果テーブル

サポートページに戻る