I'm trying to group a set of values, but I only want to display the values if there was a change.
Some example data
value | date_loaded |
1 | 2012-03-07 |
1 | 2012-03-06 |
1 | 2012-03-05 |
3 | 2012-03-04 |
4 | 2012-03-03 |
1 | 2012-03-02 |
So I would like to display the latest value, with it's earliest date, e.g.
value | date_loaded |
1 | 2012-03-05 |
3 | 2012-03-04 |
4 | 2012-03-03 |
1 | 2012-03-02 |
What is the best way to go about this? Would it be possible to do an if statement? If value 1 is different to value 2, +1 to "change" ? Therefore I'd be able to group the values by "change1", "change2" etc.?