Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Urgent:2nd highest salary without using a subquery in sql

Urgent:2nd highest salary without using a subquery in sql

Scheduled Pinned Locked Moved Database
databasecareersql-serversysadminhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rockz
    wrote on last edited by
    #1

    I want an output of 2nd highest salary without using a subquery in sql server 2005.I'm writting the following query: select empno, ename, job, sal, deptno from (select t.*, row_number() over(order by t.sal desc) seq from emp t) y where y.seq = 2 But when I run this query, I get an error: 'ROW_NUMBER' is not a recognized function name.

    P 1 Reply Last reply
    0
    • R rockz

      I want an output of 2nd highest salary without using a subquery in sql server 2005.I'm writting the following query: select empno, ename, job, sal, deptno from (select t.*, row_number() over(order by t.sal desc) seq from emp t) y where y.seq = 2 But when I run this query, I get an error: 'ROW_NUMBER' is not a recognized function name.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Using "urgent" in a subject line or forum post is considered rude.

      "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

      A 1 Reply Last reply
      0
      • P Paul Conrad

        Using "urgent" in a subject line or forum post is considered rude.

        "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

        A Offline
        A Offline
        Adeel Chaudhry
        wrote on last edited by
        #3

        In some cases.....Very rude!! Particularly if it sounds like homework!!!

        Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.

        P 1 Reply Last reply
        0
        • A Adeel Chaudhry

          In some cases.....Very rude!! Particularly if it sounds like homework!!!

          Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          Adeel Chaudhry wrote:

          it sounds like homework!!

          Yes, it does. School must be back in session...

          "I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups