Hello everyone, I'm trying to solve a simple thing but I'm stuck for several hours already. Imagine I have a price list that keeps history, basically it's two tables:
THINGS id | name 1 | thing1 2 | thing2 PRICES id | thing_id | date | price 1 | 1 | 01.01.01 | 100 2 | 1 | 01.01.02 | 150 I want to select all things, whether they have price or not, and latest price for it, so use left outer connection. db( db.thing ).select( left=db.price.on( db.thing.id == db.price.thing_id ), orderby=db.thing.name, groupby=db.thing.name ) As result I'm given 1 | thing1 | 01.01.01 | 100 2 | thing2 | none | none while I'd like 1 | thing1 | 01.01.02 | 150 2 | thing2 | none | none In other words I don't want to join a first entry, but an entry with max date. I tried tens of variants already but it already seems impossible. Meanwhile making a manual grouping and code a separate function for it seems excessive. Do you have any suggetion? or it might be someone knows how to solve it in a simple way? -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

