ソースコード
WITH
wk_order(CUST_CODE, ordercount, orderamount)
AS
 (
 SELECT
  CUST_CODE
  ,count(ORDER_NO) as ordercount
  ,sum(ORDER_AMNT)+sum(CMP_TAX) as orderamount
 FROM
  ORDERS
 WHERE
  ORDER_DATE BETWEEN '2023-09-01' AND '2023-09-30'
 GROUP BY
  CUST_CODE
 HAVING
  ordercount >= 5
 )

SELECT
 wk_order.CUST_CODE as CODE
 ,CUST_NAME as NAME
 ,ordercount as CNT
 ,orderamount as TTL_AMT
 ,round((orderamount/ordercount),1) as AVG_AMT
FROM
 wk_order
 inner join
 CUSTOMER
 on wk_order.CUST_CODE = CUSTOMER.CUST_CODE
ORDER BY
 CNT desc
 ,AVG_AMT desc
 ,CODE
LIMIT 5
提出情報
提出日時2023/12/18 09:43:51
コンテスト第10回 SQLコンテスト
問題優良顧客
受験者na1216
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量93 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
93 MB
データパターン2
WA
93 MB