PS: by the way, your query is not what I suggested :P assuming the example I posted, you are trying to do
durations = db(db.periods>0).select(db.periods.id,duration,groupby=db.periods.task_id) error here is db(db.periods>0) and not db(db.periods*.id*>0) corrected this error, you have another one.... you can't group for something that is not in the select list nor having something in the select list that is not in the groupby... either durations = db(db.periods.id>0).select(db.periods.task_id,duration,groupby=db.periods.id) #useless or durations = db(db.periods.id>0).select(db.periods.task_id,duration,groupby=db.periods.task_id) #right one!