Hi,

>From this model

db.define_table('address',
    Field('id_auth_user', 'reference auth_user', writable = False, readable 
= False),
    Field('zipcode', 'string', required=True),
    Field('town', 'string', required=True),
    Field('country, 'string', required=True),
    auth.signature)

So one user can have many addresses. I'd like to display for each user only 
the first address.

The closer solution I got is:

rows =  db(db.auth_user).select(
                            db.auth_user.first_name, db.auth_user.last_name,
                            db.address.town,
                            groupby= db.auth_user.id,
                            left = [ db.address.on(db.address.id_auth_user 
== db.auth_user.id)
                            ])

but it displays only the LAST address, not the first. I tried to use 
orderby but groupby comes apparently first when processing the query.

Mike

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

Reply via email to