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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-09-13 : 08:28:05
|
| Kim writes "I have a 319 records in sql database, how do you select records starting from 1 thru 319 increment by 30. For ex. select record 1, 31, 61, 91 .... And put all this selected records in a new table with record 1, 31, 61 ....Thanks" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-09-13 : 09:05:26
|
this should do:declare @MyTable table(id int identity, OrderId int)insert into @MyTable(orderid)select orderid from ordersselect * from @MyTablewhere (id-1)%30 = 0Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|