I've got the following dataset ordered by a specific column:
ratio
-----
1
1
1
0.8333
1
1.6667
3.3333
1
And I want to count the rows where ratio equals 1, but only until I reach a row where ratio is not 1. For the above dataset my expected result would be 3 (the first three rows).
Of course I could do this in the code, but I just wondered whether there's an SQL solution to this.