KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's say I have this (MySQL) database, sorted by increasing timestamp: Timestamp System StatusA StatusB 2011-01-01 A Ok Ok 2011-01-02 B Ok Ok 2011-01-03 A Fail Fail 2011-01-04 B Ok Fail 2011-01-05 A Fail Ok 2011-01-06 A Ok Ok 2011-01-07 B Fail Fail How do I select the rows where StatusA changed from the previous row for that system? StatusB doesn't matter (I show it in this question only to illustrate that there may be many consecutive rows for each system where StatusA doesn't change). In the example above, the query should return the rows 2011-01-03 (StatusA changed between 2011-01-01 and 2011-01-03 for SystemA), 2011-01-06, 2011-01-07. The query should execute quickly with the table having tens of thousands of records. Thanks
Tags (comma-separated)
Save Edits
Cancel