Results 1 to 4 of 4

Thread: sub query

  1. #1
    Join Date
    Mar 2007
    Posts
    2

    sub query

    hi all,
    i am new member to this site
    i have a table consisting of columns EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO

    i want add the salary of all the employess by their job title

    and i want to display the maximum value of the added salaries and the job name

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    What do you mean 'add the salary of all the employess by their job title'? Is column sal for salary?

  3. #3
    Join Date
    Mar 2007
    Posts
    1

    here is the immediate workaround

    select job, sum(sal) from emp group by job having sum(sal)=(select max(sum(sal)) from emp group by job)

    also check with analytical functions to achieve same output.

  4. #4
    Join Date
    Mar 2007
    Posts
    2
    thank u very much its working

Posting Permissions

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