How to select nth record from a table?

Answer Posted / roxy

select top 1 * from (select top n * from tbl order by col1
desc) tbl order by col1 asc

where n = nth number in the list

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is foreign key a primary key?

507


What is single-user mode and what are the steps you should follow to start sql server in single-user mode?

551


Can you explain what are commit and rollback in sql?

485


What do you need to connect php to sql server?

535


What are rows and columns?

515






What is filtered index?

649


Why would you call update statistics?

577


You want to check the syntax of a complicated update sql statement without executing it. What command should you use?

482


How to list all login names on the ms sql server?

533


What is a collation?

589


there is a trigger defined for insert operations on a table, in an oltp system. The trigger is written to instantiate a com object and pass the newly inserted rows to it for some custom processing. What do you think of this implementation? Can this be implemented better? : Sql server database administration

478


How to modify an existing stored procedure in ms sql server?

523


How you provide security to cube? : sql server analysis services, ssas

533


How many types of stored procedures are there in sql server?

554


What is truncate table?

546