You can calculate the period/quarter using (month+2)/3
:
select year, (month+2) / 3 as quarter, sum(value)
from @tbl
group by year, (month+2) / 3
order by 1,2
See fiddle
CLICK HERE to find out more related problems solutions.
You can calculate the period/quarter using (month+2)/3
:
select year, (month+2) / 3 as quarter, sum(value)
from @tbl
group by year, (month+2) / 3
order by 1,2
See fiddle
CLICK HERE to find out more related problems solutions.