Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to select nth record from a table?

Answers were Sorted based on User's Feedback



How to select nth record from a table?..

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

How to select nth record from a table?..

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

How to select nth record from a table?..

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

Post New Answer

More SQL Server Interview Questions

What is a rownum?

0 Answers  


Explain the categories of stored procedure?

0 Answers  


Please explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?

0 Answers  


How to add an address record into adventureworkslt?

0 Answers  


What is an indexing technique?

0 Answers  


What is difference between aggregate and analytic function?

0 Answers  


What is the contrast between sql and mysql?

0 Answers  


How to optimize stored procedure optimization?

0 Answers  


How to create prepared statements using odbc_prepare()?

0 Answers  


How to delete database objects with "drop" statements in ms sql server?

0 Answers  


statement (of account) Receive ID_receive Date_receive Amount_receive TO_receive From_receive Description_receive 1 2010/01/01 500 Bank Ahmed Payment from the account 2 2010/02/01 700 Bank Ahmed Payment from the account Payment ID_payment Date_payment Amount_payment From_payment To_payment Description_payment 1 2010/03/01 1000 Ahmed Sales Sale goods 2 2010/04/01 1500 Ahmed Sales Sale goods How can crate Stored Procedures for the statement (of account) from these tables? I want statement (of account) like this: (in sql 2005) ID_ name description debit account credit account balance

1 Answers  


What are all new concepts in SQL Server 2008? That is Exactly Difference between 2005 to 2008

2 Answers   IBM,


Categories