I have a MySQL table that returns a list of values that contains consecutive duplicates (when ordered by a timestamp).
For example, when querying, I need to only return the consecutively duplicated values:
[1, "Yellow"]
[2, "Yellow"]
[3, "Green"]
[5, "Black"]
[6, "Green"]
[7, "Green"]
The numbers here are being used for reference - the value is actually the string "Green", so for the above case the new unduped list would be:
[1, "Yellow"]
[3, "Green"]
[5, "Black"]
[6, "Green"]
Is there a smart way of handling this problem with MySQL?
Using Rails/ActiveRecord, not that that should make a difference, but I can do this no problems by manipulating an Array, just wondering if there is a smarter way of handling this.
Greenin the expected result intentional OR a typo?