The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Re: how to get sum(sal) for every quarter in yearwise
Dear Samba Siva,
Join your reporting date to the sys_calendar.calendar view and you can pull "quarter_of_year" from the system calendar. In case you need to change the QOY field to represent a fiscal or other operating interpretation, just build a semantic calendar view on top of the system calendar.
Sample code as below will help:
select est.emp_id, cal.quarter_of_year, sum(est.emp_sal)
from emp_salary_table est
inner join sys_calendar.calendar cal
on est.emp_salary_dt = cal.calendar_date
where cal.calendar_date between '2016-01-01' and '2016-12-31'
and est.emp_id = '123'
group by 1,2;