首页 > 数据库 > Oracle > 一个SQL语句的优化
select to_char(tt.yearmonth,'yyyy') year,to_char(tt.yearmonth,'mm') month,
tt.yearmonth,max(total) over (partition by to_char(tt.yearmonth,'yyyy') order by yearmonth)
from(select trunc(hiredate,'mm') yearmonth,max(sal) total from emp
group by trunc(hiredate,'mm') order by trunc(hiredate,'mm')) tt
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20887841/viewspace-1029432/ ,如需转载,请注明出处,否则将追究法律责任。