Can peewee nest SELECT queries such that the outer query selects on an aggregate of the inner query?
问题 I'm using peewee2.1 with python3.3 and an sqlite3.7 database. I want to perform certain SELECT queries in which: I first select some aggregate (count, sum), grouping by some id column; then I then select from the results of (1), aggregating over its aggregate. Specifically, I want to count the number of rows in (1) that have each aggregated value. My database has an 'Event' table with 1 record per event, and a 'Ticket' table with 1..N tickets per event. Each ticket record contains the event's