解答

128

SQL文(クエリ)

WITH master AS (
  SELECT
    *
  FROM
    sample.sales
    LEFT JOIN sample.products
    USING
      (product_id)
)
SELECT
  product_category
  , SUM(quantity) AS sum_qty
  , SUM(revenue) AS sum_rev
FROM
  master
GROUP BY
  1
ORDER BY
  3 DESC

結果テーブル

結果テーブル

サポートページに戻る