Results 1 to 8 of 8

Thread: Select within select

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Nov 2007
    Answers
    1

    Re: Select within select

    to find nth highest salary

    select distinct (a.sal) from emp a where &n=select (count(distinct b.sal) from emp b where a.sal<=b.sal);


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Select within select

    You can write in this way also

    SELECT ename,job,sal
    FROM
    (
    SELECT *
    FROM emp
    ORDEY BY sal DESC
    )
    WHERE ROWNUM <=10;


  3. #3
    Contributing Member
    Join Date
    Jul 2007
    Answers
    42

    Re: Select within select

    Quote Originally Posted by krishnaindia2007 View Post
    You can write in this way also

    SELECT ename,job,sal
    FROM
    (
    SELECT *
    FROM emp
    ORDEY BY sal DESC
    )
    WHERE ROWNUM <=10;
    this is called inlineview.


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