assuming.....
count = db.table.id.count()
groupby = db.table.birthday.month()
#you can do
rows = db(db.table.id >0).select(count, groupby, groupby=groupby)
for row in rows:
print row[count], row[groupby]
i.e. the variables (count, groupby) you set are automatically "translated"
to the "ugly format" you're referring to. This is the only recommended way
to deal with those, because the
row['_extra']["web2py_extract('month',person.birthdate)"]
is only valid for a specific adapter (in this case, sqlite). This means
that if you switch to mysql, it won't work.
BEWARE(closely related): in a groupby query you can only retrieve the
groupby field(s) and any other column MUST be an aggregate (i.e. count(),
sum(), etc etc)
--
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.