I have the following table:
location | eventdate | value |
---|---|---|
loc1 | 2021-11-28 | 1 |
loc2 | 2021-11-28 | 2 |
loc1 | 2021-11-29 | 1 |
loc2 | 2021-11-29 | 3 |
loc1 | 2021-11-30 | 2 |
loc2 | 2021-11-30 | 5 |
And I'd like to compare the values from the oldest availavle day and the day before that to get this result:
location | diff |
---|---|
loc1 | 1 |
loc2 | 2 |
What's the SQL statement to get this?