I have a table of integer, with two columns.
- col1 | col2
- 47 | 99
- 56 | 100
- 100 | 110
- 147 | 150
- 156 | 160
- 200 | 250
- 247 | 300
Let’s say MySQL starts to read at col1, row1, the values are 47 and 99.
What I want MySQL to do, is to select data from col1 every values+100.
So here col1 starts at 47, MySQL should select
47
147
247
FYI : this table has about 500.000 rows. .. According to stats, this should return about 50,000 rows. So I need a super-fast query.
I had several attempt that didn’t work out, with smth like that:
SELECT *
FROM (
SELECT
@row := @row +100 AS rownum, col1
FROM (SELECT @row :=0) r, my_table
) ranked
WHERE rownum % [n] = 1
do something like