I would like to have a query that based on the field "Periodicity", would repeat every N rows the value True, grouped by the field "Type". I think I can explain better with an example:
By having the next table...
id type periodicity
1 1 3
2 1 3
3 1 3
4 1 3
5 1 3
6 1 3
7 1 3
8 1 3
9 1 3
10 2 2
11 2 2
12 2 2
13 2 2
14 2 2
15 2 2
16 2 2
... I would like to have a query that would return something like this...
id type periodicity execute_operation
1 1 3 TRUE
2 1 3 FALSE
3 1 3 FALSE
4 1 3 TRUE
5 1 3 FALSE
6 1 3 FALSE
7 1 3 TRUE
8 1 3 FALSE
9 1 3 FALSE
10 2 2 TRUE
11 2 2 FALSE
12 2 2 TRUE
13 2 2 FALSE
14 2 2 TRUE
15 2 2 FALSE
16 2 2 TRUE
For the rows where the field "type" is 1, the field "execute_operation" would be marked as True every 3 rows (the value defined in the field "periodicity").
For the rows having the "type"is 2, the filed "execute_operation" would be marked as True every 2 rows.
How can I achieve this?