ソースコード
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, MEMBER_CODE AS CODE
FROM EC_ORDERS
WHERE ORDER_DATETIME BETWEEN '2023-07-01' AND '2023-07-31'
GROUP BY CODE) AS SUB
INNER JOIN MEMBER_MST MM
ON SUB.CODE = MM.MEMBER_CODE
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:44:54
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者yanagiguchi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
83 MB
データパターン2
WA
85 MB