C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

Use of TOP keyword


Posted Date: 30 Nov 2008      Posted By: Sanjay Pal      Member Level: Silver     Points: 1   Responses: 4



I have a table having 100 records
now i wants to retieve records between top 5 to 15 .





Responses

Author: Arun Jacob    30 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3


Select * from
(Select *,ROW_NUMBER() OVER(ORDER BY EmployeeID) as RowNumber from Employee)Temp
where RowNumber BETWEEN 2 AND 4


:-)

Arun Jacob
http://codepronet.blogspot.com/



Author: Deepika Haridas    30 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 3

Hi,
Select TOP 10 * from(Select *,ROW_NUMBER() OVER(ORDER BY EmployeeID) as RowNumber from Employee)Tempwhere RowNumber BETWEEN 2 AND 4

Regards,
deepika



Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: Roopesh Babu Valluru    01 Dec 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Hi Friend..


This wil help u i think...
select top 10 * from tablename where primarykeycolumn not in (select top 5 primarykeycolumn from tablename)

All The Best..



Author: sonali chougule    01 Dec 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 1

select top 15 col1 from table1
where
col1 not in(
select top 5 col1 from table1)



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Sql query
Previous : SQL server 2008
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use