sql - Oracle scenario -
please me in solving below scenario : i/p
name salary ram 200 shyam 900 rabi 700 ram 600 rabi 100 shyam 300
o/p
name. salary ram 200 ram 800 shyam 900 shyam 1200 rabi 700 rabi 800
how using oracle sql query ?
you seem want cumulative sum:
select name, sum(salary) on (partition name order id) cumesalary table t order name;
the order by
not output is. if ordering important, please more explicit rule ordering.
also, assumes have sort of id or creation date specify ordering of table. sql tables represent unordered sets, there no inherent ordering. need column specify ordering.
Comments
Post a Comment