How to skip the records

  • Ummm.... have you considered modulo? I don't recall seeing it mentioned in the solutions proffered thus far.

    where RecordNum % 3 = 1 returns every third record, assuming RecordNum is an ascending contiguous integer. Look up Modulo in BOL, it can be quite useful.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • I think you should pay a bit more attention at the thread because all solutions were based on that:

    ....

    select name from #a where id % @Sample = @Offset

    ...

    Select * from test where dbo.Ident('RowNum',[Id])%3=0

    ...

    HAVING (count(*) - 1) % @Sample = @OffSet

     

     


    * Noel

  • Gak! My bad! Comes from not being in the office for a month and a half. Got married June 4, F-I-L passed away June 15 (it was expected, just not that soon). Basically spent June in Ohio, then most of July thus far in New Mexico.

    I actually did look, why it didn't leap out at me I don't know. Must be the drugs, or lack thereof.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • Wow, too many big things in too little time !!!!      you don't need any drug


    * Noel

Viewing 4 posts - 31 through 33 (of 33 total)

You must be logged in to reply to this topic. Login to reply