Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Group by multiple years

jfosteroracleAug 10 2010 — edited Oct 30 2010
I have an application where I need to sum a field by year PLUS the the previous 2 years. When I sum simply by year, it looks like this:

select s.survey_year. sum(ac.plover_calculated_adult) AS totalCalcAdults
from dms.adult_census ac,dms.sites s
where ac.site_id = s.site_id
group by s.survey_year

How do I group by year plus the previous 2 years? I'm at a loss for how to write that.

Thanks in advance!!

JOhn
This post has been answered by Frank Kulash on Aug 10 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2010
Added on Aug 10 2010
6 comments
1,442 views