How about this?
SELECT SUM(sal) Total_sal, extract(year from hiredate) Yr
FROM scott.emp GROUP BY Rollup(extract(year from hiredate))
Login to rate this answer.
SELECT count(e.empno) Emp_Count,to_char(e.hiredate,'YYYY') hired_On
from empoyee e
where to_char(e.hiredate,'YYYY') in (1995, 1996, 1997, 1998)
group by rollup(to_char(e.hiredate,'YYYY'))
order by 2
Login to rate this answer.