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

Thread: how to get sum(sal) on top

  1. #1
    Join Date
    Dec 2002

    how to get sum(sal) on top


    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


  2. #2
    Join Date
    Dec 2000
    Ljubljana, Slovenia
    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