Hi, I have the following table:
db.define_table("track_trace", Field("id_reparaties", "reference reparaties", requires=[IS_IN_DB(db, 'reparaties.id')]), Field("id_status", "reference status"), Field("opmerking", "string", default=""), Field('is_active', 'boolean', default=True, writable=False, readable=False), Field('created_on', 'datetime', default=request.utcnow, update=request.utcnow, writable=False ,readable=False, requires=IS_DATETIME(timezone=pytz.timezone(user_timezone)), represent=lambda name,row: pytz.UTC.localize(name).astimezone(pytz.timezone(user_timezone)).strftime("%d-%m-%Y %H:%M:%S")), Field('created_by', auth.settings.table_user, default=auth.user_id, writable=False, readable=False), Field('modified_on', 'datetime', default=request.utcnow, update=request.utcnow, writable=False, readable=False, requires=IS_DATETIME(timezone=pytz.timezone(user_timezone)), represent=lambda name,row: pytz.UTC.localize(name).astimezone(pytz.timezone(user_timezone)).strftime("%d-%m-%Y %H:%M:%S")), Field('modified_by', auth.settings.table_user, default=auth.user_id, update=auth.user_id, writable=False, readable=False), migrate='track_trace.table')) Now i want to count the rows that are grouped by id_reparaties that have a certain id_status as the newest item. I am not very good with SQL so I really don't know how to do this. -- 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/groups/opt_out.