I want to count the number of consecutive int value spread through out multiple rows. For example.
Code: Select all
=> select * from kyle order by value;
value
-------
1
2
5
6
7
10
12
13
(8 rows)
- (1,2) (5,6,7) (12,13)
with the final output as the number of consecutive int in a tuple - (1,2) and (12,13) has two int. (5,6,7) has 3 int.
Code: Select all
# of consecutive int | count
2 | 2
3 | 1