ソースコード
WITH basedata AS (
	SELECT
		t2.ITEM_CODE
		,SUM(t2.ORDER_QTY) AS SUM_QTY
	FROM (SELECT ORDER_NO
		FROM ORDERS AS t0
		INNER JOIN WAREHOUSE AS t1
			ON t0.WH_CODE = t1.WH_CODE
				AND t1.WH_NAME = '浦和倉庫'
		) ti
	INNER JOIN ORDERS_DTL AS t2
		ON ti.ORDER_NO = t2.ORDER_NO
	GROUP BY 1
	HAVING SUM_QTY >= 50
)
SELECT
	t1.ITEM_CODE AS CODE
	,t2.ITEM_NAME AS NAME
	,t1.SUM_QTY
FROM basedata AS t1
LEFT OUTER JOIN ITEM AS t2
	ON t1.ITEM_CODE = t2.ITEM_CODE
ORDER BY SUM_QTY DESC,t1.ITEM_CODE DESC
提出情報
提出日時2024/06/08 16:49:06
コンテスト第1回 SQLコンテスト初級編
問題売れ筋商品
受験者katsu
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量94 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
94 MB
データパターン2
AC
84 MB