Count equal, consecutive values in an ordered rowset
|Added at||2016-12-30 20:12|
I have a table with two columns like:
and the following data in it:
You can assume that there are no duplicate values in the action_time column.
How can I count the number of same actions in a row that were made starting from the last action?
There is no limit on the number of same actions in a row, and any action can be the last one. Also, there is no limit on the variety of different actions: I used just two to simplify the example data.
For this example data I expect the result to be 3. This is because the last action was "b" and it occurred 3 times in a row.
I think the solution can be achieved combining window functions and the