I assure you you will get results, as long as there are values in the table....
try using: 1) this model in a fresh app db.define_table('entries', Field('this_is_datetime', 'datetime')) 2) fill some data in 3) create this controller function def test(): distinct_ = db(db.entries.id > 0).select(db.entries.this_is_datetime. year(), distinct=True) sum_of_entries = db.entries.id.count() grouped_ = db(db.entries.id > 0).select(sum_of_entries, db.entries. this_is_datetime.year(), groupby=db.entries.this_is_datetime.year()) return locals() 4) you'll get a similar result distinct_: web2py_extract('year',entries.this_is_datetime)20152014 grouped_: COUNT(entries.id)web2py_extract('year',entries.this_is_datetime)3201422015 if there are still issues then, please pack an app that reproduces the issue.... -- 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.