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.
| Author |
Topic |
|
cwsrad
Starting Member
4 Posts |
Posted - 2005-04-25 : 23:07:12
|
| I have a query that returns 2590 records as the resultset. I was wondering if there was a way to return every nth record in the resultset to make it easier for the client to navigate the data. For example, I would like to return every 5th record from the resultset. Is there a quick and/or easy way to do this? |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-04-26 : 00:24:00
|
Insert the result set into a temp table with an integer identity(1,1) column, ID.Then get the result like this:select col1, col2, col3, ..etc...from #tempwhere ID % 5 = 0 CODO ERGO SUM |
 |
|
|
|
|
|