SELECT rows that are a multiple of x
sql, sql-server
Solution
You can use modulo for that.
SELECT * FROM `table` WHERE (`id` % 10) = 0
SELECT * FROM `table` WHERE (`id` MOD 10) = 0
SELECT * FROM `table` WHERE !MOD(`id`, 10)
Anyone should do.
Problem
In SQL Server, how do I select rows 10, 20, 30, 40, etc where the RowID is an equal gap of some integer (+10). There are 50k rows, so using IN (1,10,20,etc) is laborious. ``` SELECT * FROM 'TABLENAME' WHERE RowID = 10 (+ 10) ```