在Oracle中有没有办法可以拉动风云?我用下面的脚本只拉了两个风云. Mytable日期范围从1998财年到2009财年.
SELECT 'FY2008' as FY,Site,COUNT(*) FROM mytable WHERE date >='10-OCT-2007' AND date <'10-OCT-2008' GROUP BY site
SELECT 'FY2008' as FY,COUNT(*) FROM mytable WHERE date >='10-OCT-2008' AND date <'10-OCT-2009' GROUP BY site
拉动两个FY是可以的,但是当拉动超过10 FY时它太重复了.
添加83天到您的日期并将其截断为全年:
select 'FY'||TRUNC(date + 83,'YYYY') as FY,count(*) from mytable group by 'FY'||TRUNC(date + 83,'YYYY'),site