Ok guys... I did step for step and now the query works for the stage (progress). The second thing (stage is multiplicator for time) I have no glue how to move on.
cards2learn = db((db.groupCards.card_id == db.card.id) \ & (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \ & (session.chosenSubject_id == db.card.subject_id) \ & (db.userCard.card_id == db.card.id) & (db.userCard.stage <= 5) \ & (db.userCard.lastTimeLearned < (date.today() - timedelta(days=(1)))) ).select(db.userCard.ALL,db.card.ALL,db.groupCards.ALL, left=db.userCard.on((db.userCard.card_id == db.card.id))) timedelta(days=(1)) should be timedelta(days=(db.userCard.stage)) but it says: <type 'exceptions.TypeError'> unsupported type for timedelta days component: Field How do I use the db.userCard.stage in timedelta (stage is an integer field in the table)? Many thanks for the previous answers! --