I have a table with below values.
Table Name: TestSeqeunce
-----------------
ID | Sno |
-----------------
1 | 1 |
2 | 1 |
3 | 0 |
4 | 0 |
5 | 0 |
6 | 1 |
7 | 0 |
8 | 1 |
9 | 1 |
10 | 0 |
-----------------
Output Explanation for Sno 1:
Sno --> 1,2 => 1
Sno --> 6 => 2
Sno --> 8,9 => 3
Output Explanation for Sno 0:
Sno --> 3,4,5 => 1
Sno --> 7 => 2
Sno --> => 3
Final Output :
---------
| Sno |
----------
| 3 | --> 1 (Three times number 1 is occurred)
| 3 | --> 0 (Three times number 0 is occurred)
---------