On Saturday, October 8, 2011 10:31:18 PM UTC-4, IK wrote: > > > {{for item in item:}} > <div> Listing {{item.title}} and max price: > > {{prices=db((db.price.id>0) & > (db.price.listing==item)).select(db.price.weekly,distinct=True)}} >
'item' is an entire row -- instead, you want item.id: (db.price.listing==item.id) Also, you shouldn't need the (db.price.id>0). You might also want to name the result of the select in the controller 'items' instead of 'item' to avoid confusion. > {{priceMax= prices.last()}} > Are the prices inserted in order, so the last is always the max? > {{=priceMax}} > If you don't need to re-use priceMax elsewhere, you can just do: {{=prices.last().weekly}} Anthony