I just wish to note something and display my gratitude (which I hope is shared by others) towards Richard, Dan and other SQLite devs for all the great functionality, but specifically CTE's.
The reason I need to say this is that I was one of the people who, when we first had requests for CTE's on this forum (if anyone fancies scrolling back), said: "C-T-E - Shmee-Tee-Eee - who would ever need that for real?" chimed along with others who had statements like "Anything you can do with CTE you can also do without it" and the like. Today the inverse is true. What an absolute pleasure to use. Even if the CTE may not be strictly needed, almost every problem or complex query can be simplified using a CTE, and easily later factored back (removing the CTE) if optimization requires it. I find also explaining query concepts to others via a CTE much easier. I now use CTE's extensively in MSSQL (thanks to SQLite showing the way) and get annoyed at MariaDB/MySQL for not having it. This also makes up amicably for SQLite's lack of script variables. Just make a CTE table full of presets to use later - problem solved. A heartfelt Thank-you! Ryan