grouping and counting

18 views
Skip to first unread message

Annet

unread,
May 24, 2018, 4:32:17 AM5/24/18
to web2py-users
In a table definition I have the following field:

db.define_table('app_settings',
    ...
    Field('viewtypeID', type='integer', requires=IS_IN_SET(viewtype_list)),
   ...
    migrate = False)

This is the viewtype_list:

viewtype_list = [(1, 'zero'), (2, 'thing'), (3, 'client'), ..., (8, 'hub')]

I have two types of users, distinguished by their e-mail starting with 'thing' or not.

What I want is to group the views by type and within a group by e-mail starting with 'thing' or not
and then count the number of views.

viewtype 1   r views of which    s thing users     t none thing users
viewtype 2   x views of which    y thing users    z none thing users
etc.


This is the join:

join =  db.auth_user.on(db.app_settings.vertexID==db.auth_user.vertexID)


Kind regards,

Annet
Reply all
Reply to author
Forward
0 new messages