Group by multiple years
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