SQLite Forum

How to convert to CTE
Login
Thanks for that. The description of what  the result should be sounds ok but I get wrong results, much too high numbers.
The other problem is that it is very slow. The table reg_history_all has some 145000 rows.
Would it be possible to run the sql I posted as a CTE with increasing dates in the date range?

RBS