Return a set of records only if they are in a certain order

I have a table with the following records ordered by timestamp

Id   TimeStamp      Action
--   ---------      ------
1    #1             ActionType#1
2    #2             ActionType#2
3    #3             ActionType#2
4    #4             ActionType#1
5    #5             ActionType#3
.    .              .
.    .              .
.    .              .
52   #52             ActionType#1
53   #53             ActionType#2
.    .              .

I want to write a query that would return to me a set of records, only if the records are in a particular sequence order.

For example on the data above, I want a query to: "Get when Action#2 occurred after Action#1, in sequence, as per timestamp order."

Should return to me:

##First matching sequence

2    #2             ActionType#1
3    #3             ActionType#2
##Second matching sequence

52   #2             ActionType#1
53   #3             ActionType#2

Note: This is in an ASP.NET application so LINQ style answers are welcome


I would consider an effective solution based on for loop over your table:

List<myRecordClass> myResults = new List<myRecordClass>();

for (int i = 1; i < myTable.Count; i++)
    {
        if (myTable.ElementAt(i).Action == myTable.ElementAt(i-1).Action)
        {
            myResults.Add(myTable.ElementAt(i - 1));
            myResults.Add(myTable.ElementAt(i));
        }
    }

This would allow you to implement other tests involving for example 3 consecutive records.