Results 1 to 3 of 3

Thread: needa solution!!!!

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Answers
    1

    Question needa solution!!!!

    hi frends....
    i want to calculate the second max sal?
    how can i?
    can we use 'count' for that?


  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: needa solution!!!!

    In SQL server

    select max(sal) from employee where sal not in (select max(sal) from employee)

    we are using sub queries for this scenario. First of all we are eliminating the record which has the maximum salary. This is done by not in operator. From the rest of the records if we fetch the maximum salary, that is the second highest salary

    ----------------------
    suresh


  3. #3
    Junior Member
    Join Date
    Oct 2006
    Answers
    6

    Re: needa solution!!!!

    select max(salary) from kani where salary not in
    (select top 1 salary from kani order by salary desc)


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