问题 I've got a SQL statement that does what I need, but I'm having trouble converting it into the correlated Peewee statement. Here's the SQL I have now, note that I'm using a subquery right now, but I don't care that it's a subquery either way. select t.name, count(a.type_id) as total, ( select count(id) from assignment a where a.course_id = 7 and a.due_date < date() and a.type_id = t.id group by a.type_id order by a.type_id ) as completed from assignment a inner join type t on t.id = a.type_id