Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to get a part of result set?

Author  Topic 

beliveinmyshelf
Starting Member

15 Posts

Posted - 2008-07-09 : 05:11:35
thank for read!!!! please help me

ex : i execute select statement : "select * from examle".
later assume result is :
==========
name |
==========
sqlteam1 |
sqlteam2 |
sqlteam3 |
sqlteam4 |
sqlteam5 |
sqlteam6 |
sqlteam7 |
=========

but i only want to get from "sqlteam3" to "sqlteam5".
how to do?

Tran Manh Linh - Linhtm
linhtm.viss@gmail.com
linhtm@vietintelligences.com

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-09 : 05:20:53
[code]SELECT t.name
FROM
(SELECT ROW_NUMBER() OVER(ORDER BY name) as RowNo,*
FROm YourTable)t
WHERE t.RowNo >=3 AND t.RowNo<=5[/code]
Go to Top of Page

beliveinmyshelf
Starting Member

15 Posts

Posted - 2008-07-09 : 05:38:16
thank for reply. have a good day.

Tran Manh Linh - Linhtm
linhtm.viss@gmail.com
linhtm@vietintelligences.com
Go to Top of Page

bjoerns
Posting Yak Master

154 Posts

Posted - 2008-07-09 : 07:26:08
SELECT name
FROM YourTable
WHERE name BETWEEN 'sqlteam3' AND 'sqlteam5'

Go to Top of Page
   

- Advertisement -