Oracle Query使用分区显示

时间:2017-05-02 07:18:02

标签: oracle

输入表是

eno ename sal

10 satish   1000
20 soujanya 1300
10 satish   2000
20 soujanya 1500

输出表如

emp ename sal

10 satish   3000
20 soujanya 2800

2 个答案:

答案 0 :(得分:1)

我想你需要这个:

select eno, ename, sum(sal)   from t group by eno, ename

答案 1 :(得分:0)

试试这个

select eno, ename, sum(sal) over (partition by eno order by ename)   from t