Hi,

I have used the methods given in the web2py manual, in the "One to
Many Relation" part, to try and combine a left outer join with
grouping and counting.  But I did not manage.

The examples given are:

>>> rows=db().select(db.person.ALL, db.dog.ALL, 
>>> left=db.dog.on(db.person.id==db.dog.owner))
>>> for row in rows:
        print row.person.name, 'has', row.dog.name
Alex has Skipper
Alex has Snoopy
Bob has Puppy
Carl has None

>>> count = db.person.id.count()
>>> for row in db(db.person.id==db.dog.owner).select(db.person.name, count, 
>>> groupby=db.person.id):
        print row.person.name, row._extra[count]
Alex 2
Bob 1

What should the query be to get such a result:
Alex 2
Bob 1
Carl 0

Thank you,
Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to