ソースコード
SELECT ORDER_DATETIME AS ORDER_DATE, CODE,
CASE WHEN OPTOUT_TYPE = 0 THEN '可'
WHEN OPTOUT_TYPE = 1 THEN '不可'
ELSE '不明' END AS OPTOUT
FROM (SELECT MIN(ORDER_DATETIME) AS ORDER_DATETIME, E.MEMBER_CODE AS CODE, OPTOUT_TYPE
FROM EC_ORDERS E INNER JOIN MEMBER_MST M
ON E.MEMBER_CODE = M.MEMBER_CODE
WHERE ORDER_DATETIME BETWEEN '2023-07-01' AND '2023-07-31'
GROUP BY CODE) AS SUB
WHERE EXISTS
(SELECT ORDER_NO FROM EC_ORDERS
WHERE SUB.CODE = MEMBER_CODE
AND ORDER_DATETIME < DATE(SUB.ORDER_DATETIME, '-1 year'))
AND NOT EXISTS
(SELECT ORDER_NO FROM EC_ORDERS
WHERE SUB.CODE = MEMBER_CODE
AND ORDER_DATETIME BETWEEN DATE(SUB.ORDER_DATETIME, '-1 year') AND DATE(SUB.ORDER_DATETIME, '-1 day'))
ORDER BY ORDER_DATE DESC, CODE DESC
提出情報
提出日時2024/06/16 14:38:39
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者yanagiguchi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
WA
84 MB