For once, I have no idea where to start on my SQL problem. I have a database table that can be simplified (for this problem) to 3 columns:
This table currently has > 1,000,000 rows (and at least 10 other columns). The Example_DateAndTime column is different on almost all rows. The Example_Value column is quite often the same (changing less than once a day).
What I would like to do is find all the dates where the value is different to the previous value.
So out of the 1,000,000 rows, if Example_Value has only been changed 5 times, I would only want 6 rows (I would want the very first row as well.)
I can get the first date that each value occurs, but this is not correct. If value is changed from 200 to 500 to 302 to 200 to 302 to 404, there should be 6 rows, even though value may have been changed back to a previous value.
Does anyone have any ideas?
MySQL Version: 5.0.45