ソースコード
with BASE as (
select
    ITEM_CODE,
    count(ORDER_QTY) as item_qty,
    max(ORDER_DATE) as new_order_date
from
    ORDERS o
inner join
    ORDERS_DTL od
on
    od.ORDER_NO = o.ORDER_NO
where
    ORDER_DATE between '2023-04-01' and '2023-06-30'
group by
    ITEM_CODE
),
C00 as (
select 
    *,
    rank() over(order by item_qty desc, new_order_date desc, ITEM_CODE desc) as rank
from
    BASE
),
CODE as (
select
    ITEM_CODE
from
    ITEM
group by
    ITEM_CODE
),
C01 as (
select
    CODE.ITEM_CODE,
    COALESCE(rank, 0) as rank
from
    CODE
left join
    C00
on
    C00.ITEM_CODE = CODE.ITEM_CODE
)
update
    ITEM
set
    ITEM_POPULAR_RANK = C01.rank
from
    C01
where
    C01.ITEM_CODE = ITEM.ITEM_CODE

    
提出情報
提出日時2024/12/03 17:31:09
コンテスト第8回 SQLコンテスト
問題人気順位
受験者wanku
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
85 MB
データパターン2
WA
85 MB