When I use nested CTE's I get a syntax error in SQLiteStudio (version 3.4.3). When I run the same query on the SQLite command line, it works without any issues ...