Hi,
I am trying to write a query to return every nth record i.e. every 20th
I am using the sql:
where the ID is like 'TEST0001' and so on. I have 100 records for example but if returning every 20th record I'd expect my first record id from the query to be TEST0020, but the first record seems to always be the 30th.
Can someone check the sql, I am using sql2000
Thank You
I am trying to write a query to return every nth record i.e. every 20th
I am using the sql:
Code:
select * from TABLE
where RIGHT(ID,4) % 20 = 0
and ID like 'TEST%'
where the ID is like 'TEST0001' and so on. I have 100 records for example but if returning every 20th record I'd expect my first record id from the query to be TEST0020, but the first record seems to always be the 30th.
Can someone check the sql, I am using sql2000
Thank You