Count for consecutive records
- by Nai
I have a table as follows
> RowID SessionID EventID IPAddress RequestedURL Date
> 1 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 Start 24/03/2010 19:52
> 2 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 BuyNow 24/03/2010 19:52
> 3 m2jqyc45gtjmvb55dc4dg 28 82.23.149.238 Clicked OK 24/03/2010 19:52
> 4 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 ProductPage 24/03/2010 19:52
> 5 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 Home 24/03/2010 19:56
> 6 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 ProductPage 24/03/2010 19:56
> 7 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 BuyNow 24/03/2010 19:56
> 8 m2jqyc45gtjmvb55dc4dg 28 82.23.149.238 Clicked OK 24/03/2010 19:56
> 9 m2jqyc45gtjmvb55dc4dg 1 82.23.149.238 Home 24/03/2010 19:56
How do I write a query that does a count whenever the rows BuyNow and Clicked OK have been recorded consecutively.
For example, the dataset above, the return count should be 2.