このクエリを前の、たとえば 61 週間を表示するにはどうすればよいでしょうか?
select
to_char(order_date,'IYYY') as iso_year,
to_char(order_date,'IW') as iso_week,
sum(sale_amount)
from orders
where
to_char(order_date,'IW') <> to_char(SYSDATE) --exclude this week in progress
and to_char(order_date,'IYYY') = 2010
group by
to_char(order_date,'IYYY')
to_char(order_date,'IW')
私の最初の本能はすることです
where
to_char(order_date,'IW') <> to_char(SYSDATE) --exclude this week in progress
and to_char(order_date,'IYYY') >= to_char(order_date,'IW') - 61
「2010」の要件を省略して、結果を 61 行に制限できますか? より良い方法はありますか?
私を正しい方向に向けてくれてありがとう!