ソースコード
SELECT
DAMIN AS ORDER_DATE
,EC_ORDERS.MEMBER_CODE AS CODE
,CASE MEMBER_MST.OPTOUT_TYPE
      WHEN 0 THEN '可'
      WHEN 1 THEN '不可'
      ELSE '不明' 
 END                    AS OPTOUT
FROM
EC_ORDERS
LEFT JOIN
(SELECT MEMBER_CODE AS MINCODE,MIN(ORDER_DATETIME) AS DAMIN
FROM EC_ORDERS
WHERE ORDER_DATETIME LIKE '2023-07%'
GROUP BY MINCODE
ORDER BY ORDER_DATETIME)
ON EC_ORDERS.MEMBER_CODE = MINCODE
LEFT JOIN MEMBER_MST
ON EC_ORDERS.MEMBER_CODE = MEMBER_MST.MEMBER_CODE
WHERE EC_ORDERS.ORDER_DATETIME NOT LIKE '2023-07%'
GROUP BY EC_ORDERS.MEMBER_CODE
HAVING cast(julianday(DAMIN) - julianday(MAX(ORDER_DATETIME)) as integer) >= 365
--AND NOT EXISTS (SELECT * FROM EC_ORDERS WHERE cast(julianday(DAMIN) - julianday(ORDER_DATETIME) as integer) < 365 AND )
--GROUP BY MEMBER_CODE
;
提出情報
提出日時2023/10/22 16:21:59
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者AAAmichi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量75 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
75 MB
データパターン2
WA
74 MB