| |
GeekInterview.com > Placement Papers > KPIT
| Print | |
Question: In the emp table : > > EMPNO ENAME SAL > ================== > 7369 SMITH 1000 > 7499 ALLEN 2000 > 7521 WARD 3000 > 7566 JONES 4000 > 7654 MARTIN 5000 > > there is a requirement to have a calculated col. > called cummulative sal > > EMPNO ENAME SAL CUMMULATIVE_SAL > 7369 SMITH 1000 1000 > 7499 ALLEN 2000 3000 > 7521 WARD 3000 6000 > 7566 JONES 4000 10000 > 7654 MARTIN 5000 15000 > > How to show this calculated col. by using one > select statement?
|
| May 05, 2006 01:10:58 |
#1 |
| Suraj Marathe |
Member Since: Visitor Total Comments: N/A |
RE: In the emp table :> > EMPNO ENAME... |
select empno,ename,sal,(select sum(sal) from emp e1 where e1.rowid<=e.rowid) COMMULATIVE_SAL from emp e |
| |
Back To Question | |