how to get sum(sal) on top
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: how to get sum(sal) on top

  1. #1
    Join Date
    Dec 2002
    Posts
    110

    how to get sum(sal) on top

    Hi

    My requirment is to get the sum(sal) on top & then individual salaries in a rollup function . How can i get this.

    Say if i have

    select deptno , sum(sal) group by rollup(deptno)
    i get the sum(sal) for each deptno below the individual salaries in each dept.
    What i want is sum(sal) of each dept as the first entry in my resultset sql query & then followed by individual salaries of that
    dept.


    Bye

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    select * from
    (select deptno , sum(sal) from scott.emp group by rollup(deptno))
    order by deptno nulls first;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width