解答

204

SQL文(クエリ)

WITH master AS (
  SELECT
    cid
    , session_count
    , MIN(date_time) AS min_date_time
  FROM
    sample.web_log
  GROUP BY
    1
    , 2
)
SELECT
  page AS landing_page
  , COUNT(*) AS sessions
FROM
  (
    SELECT
      wl.cid
      , wl.session_count
      , wl.date_time
      , wl.page
      , wl.date_time
      , master.min_date_time
    FROM
      sample.web_log AS wl
      JOIN master
      ON  wl.cid = master.cid
      AND wl.session_count = master.session_count
      AND wl.date_time = master.min_date_time
    WHERE
      wl.date_time = master.min_date_time
  )
GROUP BY
  page
ORDER BY
  2 DESC
LIMIT 3

結果テーブル

結果テーブル

サポートページに戻る