解答

136

SQL文(クエリ)

WITH master AS (
  SELECT
    order_id AS orders
    , SUM(revenue) AS sum_rev
  FROM
    sample.sales
  GROUP BY
    order_id
)
SELECT
  COUNT(DISTINCT orders) AS count_orders
  , SUM(sum_rev) AS sum_rev
  , SUM(sum_rev) / COUNT(DISTINCT orders) AS average_order_value
FROM
  master

結果テーブル

結果テーブル

サポートページに戻る