[ad_1]
I have the following SQL table
username | Month |
---|---|
292 | 10 |
123 | 12 |
123 | 1 |
123 | 2 |
123 | 4 |
345 | 6 |
345 | 7 |
I want to query it, to get each username’s login streak in Count of sequential Month. meaning the end result I am looking for looks like this :
username | Streak |
---|---|
292 | 1 |
123 | 3 |
345 | 2 |
How can I achieve it ? taking into note the Month 12 –> Month 1 issue;
Appreciate your help;
[ad_2]