I have a table ("log") of points awarded to students for various activities. I want to produce a summary of total points per student. This query works...
db().select(db.auth_user.ALL, db.log.points.sum(), left=db.log.on(db.auth_user.id == db.log.user), groupby=db.auth_user.id) but does not include students with no entries in the log table. I'd like them to have a point total of 0. I suspect the problem is with db.log.points.sum() failing on null values, but I don't know how to include them. Suggestions?