ソースコード
select 
    min(order_datetime) as ORDER_DATE,
    member_code
from ec_orders
where date(order_datetime) between '2023-07-01' and '2023-07-31'
group by member_code;

select
    max(order_datetime) as max_orderdate,
    member_code
from ec_orders
where order_datetime<'2023-07-01'
group by member_code;

SELECT julianday('2023-07-15') - julianday('2022-07-14');

with mino as (
    select 
        min(order_datetime) as ORDER_DATE,
        member_code
    from ec_orders as o
    where date(order_datetime) between '2023-07-01' and '2023-07-31'
    group by member_code 
),
maxo as (select
        max(order_datetime) as max_orderdate,
        member_code
    from ec_orders
    where date(order_datetime)<'2023-07-01'
    group by member_code
)
select 
    ORDER_DATE,
    mino.member_code as CODE,
    case optout_type
        when 0 then '可'
        when 1 then '不可'
    else '不明'
    end as OPTOUT
from mino
inner join maxo
on mino.member_code=maxo.member_code
inner join member_mst as mem
on mino.member_code=mem.member_code
where julianday(date(order_date))-julianday(date(max_orderdate))>365
order by order_date desc,code desc;






提出情報
提出日時2024/06/23 18:58:02
コンテスト第9回 SQLコンテスト
問題クーポン配布対象
受験者kate
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
AC
85 MB