I have a column with values from '10000023' TO '50000000', i need to create a second column filling in for every row from 10000023 to 10000023+500 and go on.
Eg.
Pos | Interval_pos
10000023 100000523
10000523 100001023
... ...
49999500 50000000
Use generate_series()
:
select pos, pos + 500
from (select generate_series(minpos, maxpos - 500, 500) as pos
from (select min(pos) as minpos, max(pos) as maxpost
from t
) t
) t