I have data stored in a SQLITE3 database with this format:
id | ts | data ...
475158|2019-11-12 07:50:00 | ...
So I used to group by day, month, year, eg:
SELECT STRFTIME("%Y-%m", ts), SUM(<data in my table>)
FROM ( <my table> )
GROUP BY STRFTIME("%Y-%m", ts)
ORDER BY ts
Now I would like to do the same but based on an anniversary date.
For example if the anniversary date is 2010-11-17, I would like to get a result grouped by year but between 'YYYY'-11-17 and 'YYYY+1'-11-16
Example:
2017 |sum of data between 2016-11-17 & 2017-11-16
2018 |sum of data between 2017-11-17 & 2018-11-16
2019 |sum of data between 2018-11-17 & 2019-11-16
Is it possible easily?