Results 1 to 3 of 3

Thread: Department wise max salary

  1. #1
    Geek_Guest
    Guest

    Department wise max salary

    I have employee table, with empno, empname, deptno, sal fields.
    What I want is I want to get department wise max salary.
    my table data would be

    empno empname deptno sal
    1 vipul 2 200
    2 hitesh 2 300
    3 raj 2 100
    4 mac 1 200
    5 alex 1 300
    6 mo 3 100

    so result should be
    deptno empno sal
    1 5 300
    2 2 300
    2 6 100

    any ideas?

    Question asked by visitor vipul


  2. #2
    Junior Member
    Join Date
    Apr 2007
    Answers
    1

    Re: Department wise max salary

    select deptno,max(sal) from emp
    group by deptno


  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Department wise max salary

    Its so simple

    select deptno,max(sal) from emp group by deptno;


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact