ソースコード
SELECT
    A.CODE,
    A.ORDER_DATE,
    A.OPTOUT,
    B.ORDER_DATE B2
FROM
    (
    SELECT 
        MM.MEMBER_CODE CODE,
        MIN(EO.ORDER_DATETIME) ORDER_DATE,
        CASE MM.OPTOUT_TYPE
            WHEN 0 THEN "可"
            WHEN 1 THEN "不可"
            ELSE "不明"
        END OPTOUT
    FROM
        MEMBER_MST MM
    INNER JOIN
        EC_ORDERS EO ON MM.MEMBER_CODE = EO.MEMBER_CODE
    WHERE 1=1
        AND EO.ORDER_DATETIME >= "2023-07-01"
        AND EO.ORDER_DATETIME < "2023-08-01"
    GROUP BY
        MM.MEMBER_CODE
    ) A
    INNER JOIN 
    (
    SELECT 
        MM.MEMBER_CODE CODE,
        MAX(EO.ORDER_DATETIME) ORDER_DATE
    FROM
        MEMBER_MST MM
    INNER JOIN
        EC_ORDERS EO ON MM.MEMBER_CODE = EO.MEMBER_CODE
    WHERE
        EO.ORDER_DATETIME < "2023-07-01"
    GROUP BY
        MM.MEMBER_CODE
    ) B
    ON A.CODE = B.CODE
    -- )
 WHERE
     B.ORDER_DATE < date(A.ORDER_DATE, "-1 years") 
ORDER BY
    A.ORDER_DATE DESC,
    A.CODE DESC
提出情報
提出日時2023/10/14 21:17:49
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者fractal1024
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量77 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
76 MB
データパターン2
WA
77 MB