ソースコード
with T1 as (
    select MEMBER_CODE,min(ORDER_DATETIME) DT from EC_ORDERS where ORDER_DATETIME between '2023-07-00' and '2023-08-00' group by MEMBER_CODE
),
    T2 as (
        select distinct  EC.MEMBER_CODE  as memc from EC_ORDERS EC inner join T1 on EC.MEMBER_CODE=T1.MEMBER_CODE
                 where DATE(ORDER_DATETIME)>=DATE(T1.DT, '-1 year') and ORDER_DATETIME<T1.DT
    )
    select
        T1.DT as ORDER_DATE,
        EC.MEMBER_CODE as CODE,
        case when MEMBER_MST.OPTOUT_TYPE=0 then '可' when MEMBER_MST.OPTOUT_TYPE=1 then '不可' else '不明' end as OPTOUT

        from EC_ORDERS EC inner join  T1 on EC.MEMBER_CODE=T1.MEMBER_CODE and ORDER_DATETIME<T1.DT
        inner join MEMBER_MST on EC.MEMBER_CODE=MEMBER_MST.MEMBER_CODE
    where DATE(ORDER_DATETIME)<DATE(T1.DT, '-1 year') and EC.MEMBER_CODE not in (select memc from T2)
order by 1 desc,2 desc
;
提出情報
提出日時2023/10/16 09:41:51
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者tamurakami
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量91 MB
メッセージ
テストケース(通過数/総数)
1/2
状態
メモリ使用量
データパターン1
AC
91 MB
データパターン2
WA
87 MB