コンテストの制限時間が終了しました。
以降も提出を行うことができますが、順位集計には反映されません。
以降も提出を行うことができますが、順位集計には反映されません。
ソースコード
update ITEM
set ITEM_POPULAR_RANK = B.ida
from
(
select row_number() over (order by cnt, 0 desc, max(ORDER_DATE) desc, it.ITEM_CODE desc) as ida
, it.ITEM_CODE , ifnull(cnt, 0), max(ORDER_DATE) as dt from ITEM as it
left join ORDERS_DTL as od on od.ITEM_CODE = it.ITEM_CODE
left join ORDERS as o on o.ORDER_NO = od.ORDER_NO
inner join (
select it.ITEM_CODE ,
sum(ORDER_QTY),0 as cnt from ITEM as it
left join ORDERS_DTL as od on od.ITEM_CODE = it.ITEM_CODE
left join ORDERS as o on o.ORDER_NO = od.ORDER_NO
where ORDER_DATE between '2023-04-01' and '2023-06-30'
group by it.ITEM_CODE
order by cnt desc
) as temp on temp.ITEM_CODE = it.ITEM_CODE
group by it.ITEM_CODE
order by cnt desc,dt desc, it.ITEM_CODE desc) as B
where ITEM.ITEM_CODE = B.ITEM_CODE
;
update ITEM
set ITEM_POPULAR_RANK = 0
from
(
select row_number() over (order by cnt, 0 desc, max(ORDER_DATE) desc, it.ITEM_CODE desc) as ida
, it.ITEM_CODE , ifnull(cnt, 0) as cnt, max(ORDER_DATE) as dt from ITEM as it
left join ORDERS_DTL as od on od.ITEM_CODE = it.ITEM_CODE
left join ORDERS as o on o.ORDER_NO = od.ORDER_NO
left join (
select it.ITEM_CODE ,
sum(ORDER_QTY),0 as cnt from ITEM as it
left join ORDERS_DTL as od on od.ITEM_CODE = it.ITEM_CODE
left join ORDERS as o on o.ORDER_NO = od.ORDER_NO
where ORDER_DATE between '2023-04-01' and '2023-06-30'
group by it.ITEM_CODE
order by cnt desc
) as temp on temp.ITEM_CODE = it.ITEM_CODE
group by it.ITEM_CODE
order by cnt desc,dt desc, it.ITEM_CODE desc) as B
where ITEM.ITEM_CODE = B.ITEM_CODE and B.cnt = 0;
提出情報
提出日時 | 2023/08/21 11:51:31 |
コンテスト | 第8回 SQLコンテスト |
問題 | 人気順位 |
受験者 | ryo_tokyo |
状態 (詳細) | WA (Wrong Answer: 誤答) |
メモリ使用量 | 104 MB |
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
104 MB
データパターン2
WA
103 MB