How to disambiguate a sequence in sql?

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-03-22T13:32:40Z Indexed on 2010/03/22 14:01 UTC
Read the original article Hit count: 258

Filed under:

I have a table of data which represents a series of events that persons do over time, sometimes people do the same thing several times in a row. How to select a result using MS SQL 2008 that shows only disambiguated sequences of those events?

Source data:
Person   Event  Time
1        2      1
1        2      20
1        2      33
2        1      34
1        4      43
1        2      44
2        3      45
1        2      46
1        3      50
1        3      55

Result:
Person   Event
1        2
2        1
1        4
1        2
2        3
1        3

© Stack Overflow or respective owner

Related posts about sql-server