-
Display Records with subtotal
Need to display all records with the subtotals at the bottom grouped by say name column. I need to get the result in a cursor so i can pass the value to the open system.
I am able to get subtotal separately using sum and group by functions. But in the cursor the result set should be in the following format
Eg:
H 20
H 10
30
K 40
K 20
K 10
70
S 10
10
110
-
using Rollup and CUbe commands
Rollup command is used to finding the sub totals
select deptno, job, count(*), sum(sal)from emp group by rollup(deptno,job)
select deptno, job,count(*), sum(sal) from emp
group by cube(deptno, job)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|