I'm trying to do a groupby that gets the last entry for each item checked 
out by a user from db.checkout (i.e. they've checked it out multiple times, 
but I just want the last entry).  I then want to join on db.item.

db.checkout:
user_id
item_id (reference item)

db.item:
item_name

WITHOUT the join works perfectly, giving me the last entry for each item 
checked out by this user:

db(db.checkout.user_id == 1).select(groupby=~db.checkout.item_id)

But WITH the join, it groups by the FIRST checkout entry for each item_id 
for this user (although it *displays* those groups in reverse item_id 
order):

db((db.checkout.user_id == 1) &
   (db.item.id == db.checkout.item_id)).select(groupby=~db.checkout.item_id)

What am I missing?

-- 
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.

Reply via email to