I currently have this set of data.
| Id | pattern |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 1 |
| 4 | 2 |
| 5 | 3 |
| 6 | 4 |
| 7 | 1 |
| 8 | 2 |
| 9 | 1 |
| 10 | 2 |
| 11 | 3 |
I have ids sorted ascending, and a column called pattern. The goal is to retrieve only the rows with a consecutive pattern >=3 down the table.
So the result would be:
| Id | pattern |
|---|---|
| 3 | 1 |
| 4 | 2 |
| 5 | 3 |
| 6 | 4 |
| 9 | 1 |
| 10 | 2 |
| 11 | 3 |
Since the pattern for Ids 3-6 have consecutively reached >=3, we will return these 4 rows. Same goes for Ids 9-11.
Id 1-2 did not reach the threshold of 3. Same for Id 7-8.
Would appreciate any help!