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. How to find nth record in a table using sqlserver.

How to find nth record in a table using sqlserver.

Scheduled Pinned Locked Moved Database
helptutorialquestion
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.
  • S Offline
    S Offline
    Sophia Rekhi
    wrote on last edited by
    #1

    Hi all, i want to know How to find exact record in my table. ex : in a table having 10 records. i want 5 th record. with out knowing details containg in a table how can i find it. only know table name. pls help me.

    I K 2 Replies Last reply
    0
    • S Sophia Rekhi

      Hi all, i want to know How to find exact record in my table. ex : in a table having 10 records. i want 5 th record. with out knowing details containg in a table how can i find it. only know table name. pls help me.

      I Offline
      I Offline
      iprasad007
      wrote on last edited by
      #2

      Here u get the 5th record SELECT TOP 1 FName FROM ( SELECT TOP 5 FName FROM Names ORDER BY FName Desc )

      S 1 Reply Last reply
      0
      • S Sophia Rekhi

        Hi all, i want to know How to find exact record in my table. ex : in a table having 10 records. i want 5 th record. with out knowing details containg in a table how can i find it. only know table name. pls help me.

        K Offline
        K Offline
        Krish KP
        wrote on last edited by
        #3

        Are you trying to get nth Max or Min value or trying to fetch specific row by number.

        Regards KP

        1 Reply Last reply
        0
        • I iprasad007

          Here u get the 5th record SELECT TOP 1 FName FROM ( SELECT TOP 5 FName FROM Names ORDER BY FName Desc )

          S Offline
          S Offline
          Sophia Rekhi
          wrote on last edited by
          #4

          hi Prasad, Thanks for u r valuable solution, its working by making some modifications. this is working properly SELECT TOP 1 sal FROM prs where sal in (SELECT TOP 4 sal FROM prs ORDER BY sal )order by sal desc all the best

          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