Re: crack this SQL query
Date: Mon, 11 Oct 1999 11:36:02 +0200
Message-ID: <3801AF82.84F2960E_at_aon.nl>
[Quoted] maybe this will do the trick
1 select a.deptno,a.emp,a.sal,sum(b.sal)
2 from emp a
3 ,emp b
4 where a.deptno=b.deptno
5 and b.emp<= a.emp
6* group by a.deptno,a.emp,a.sal
hpg40c.DIB1 SQL> /
DEPTNO EMP SAL SUM(B.SAL)
======== === ======== ==========
10 a 100 100 10 b 125 225 10 c 127 352 30 de 260 260 30 fg 2030 2290
Kannan Anantharaman wrote:
> hii there. i have a very unique SQL query, which i have been posting to many
> oracle pros. but i can't seem to get the right answer. so if anyone can
> crack this, i'll be very grateful.
>
> the query goes like this .... GIVE THE SELECT STATEMENT TO LIST THE EMPLOYEE
> NAMES AND THEIR CUMULATIVE SALARIES, DEPARTMENT WISE. you have to use the
> EMP table which comes along with the demo database.
>
> in short, the query should produce the results in the following format :-
> (approx.)
>
> deptno ename sal cumsal
> 10 abcd 1000 1000
> efgh 2000 3000
> ijkl 1500 4500
> 20 xyz 4000 4000
> pqr 2400 6400
>
> please help me solve this long-standing sleepless-nights-giving query.
Received on Mon Oct 11 1999 - 11:36:02 CEST