Answer the question
In order to leave comments, you need to log in
How to divide a SQL table into N parts and perform calculations on each?
There is a table like this:
timestamp | a | b
-------------------------------
01.02.2018 10:20:05 | 100 | 200
01.02.2018 10:20:10 | 150 | 150
01.02.2018 10:20:15 | 100 | 300
...... ещё очень много строчек .......
Answer the question
In order to leave comments, you need to log in
I give an idea (did not check the syntax):
select mod(rn, N) part_number,
t1.*
from
(
select t.*,
row_number() over() rn
from table as t
) as t1
N - number of parts, table - your table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question