Hi Stex Hmm, again your solution seems very complex.
Luckily, you confirmed the results you expect so I propose the following solution would be simpler? maxdate = db.prop_val.val_date.max() rows = db(db.prop.id == db.prop_val.prop_id).select( db.prop.name,maxdate,db.prop_val.amount,db.prop.price,groupby=db.prop.name) Result: prop.nameMAX(prop_val.val_date)prop_val.amountprop.price aaa 2016-01-15 15 10 bbb 2016-01-20 6 15 ccc 2016-01-25 25 20 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.