Home » RDBMS Server » Server Administration » query
query [message #371632] Fri, 17 November 2000 02:20 Go to next message
devendra vaidya
Messages: 2
Registered: November 2000
Junior Member
we want a query which would give a cumulative total
eg
name sal cumulative sal
smith 1000 1000
clark 2000 3000
adam 3000 6000
Re: query [message #371637 is a reply to message #371632] Fri, 17 November 2000 09:13 Go to previous message
Babu Paul
Messages: 38
Registered: November 2000
Member
Hi,

Assuming that this is an emp table containing name and salary information of employee, your query should look something like this to get the result:

SELECT a.ename, a.salary, sum(b.salary) cum_salary
FROM emp a, emp b
WHERE b.ename <= a.ename
GROUP BY a.ename, a.salary
ORDER BY a.ename ;

Good Luck!
Babu
Previous Topic: Re: How to get the missing information from a table?
Next Topic: Re: Truncate Table problem
Goto Forum:
  


Current Time: Thu May 02 21:20:12 CDT 2024