How to select nth record from a table?
Answers were Sorted based on User's Feedback
Answer / ravinder pawar
Hi Frnds,
Pravin's logic is correct. I am just modifying it little
bit.
Select Top 1 *
From (Select Top 5 *
from HumanResources.Employee
order by EmployeeID desc)as temp
---Note If we don't use temp we'll get error as mentioned
below:
Incorrect syntax near ')'.
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / pravin s. ahire
Select Top 1 *
From (Select Top N * from tablename order by
table.ColumnName desc)
-- where N = nth record
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sajida
--For ex in dept table to select 5th record. Instead of
this you can use &n so that it can ask row number
select rnum, d.* from dept d, (select rownum rnum ,
deptno from dept ) e
where d.deptno = e.deptno and rnum = 5
| Is This Answer Correct ? | 5 Yes | 10 No |
How to create a simple table to test triggers in ms sql server?
Explain use of expression builder.
How to replace null values in expressions using isnull()?
What are SQL Jobs, please mention the use of it and how to create them.
Explain index in sql server?
What is delete query?
What is a Join and explain its types?
What is resource db in sql server?
what is macro?
5 Answers Excel, Global Innovation, Wipro,
What are the benefits of filtered indexes?
Explain active/passive and active/active cluster configurations?
How we create SQL Server 2005 Reporting Services ? Give me Sample
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)