Hi, I am using Postgresql and encountered the following errors. These errors do not come up when I use SQLite.
I have the following code: ###MODEL db.define_table('deals', Field('deal_name', 'string',length=255,requires=IS_NOT_EMPTY()), Field('num_A', 'integer',default=0), Field('num_B','integer',default=0), Field('num_C', 'integer',default=0), Field('month', requires=IS_IN_SET([1,2,3])), Field('approved', 'boolean',label="Approved?"), Field('created_by', 'reference auth_user',default=auth.user_id,writable=False,readable=False), ) ###CONTROLLER FIRST ATTEMPT rows = db(db.deals.approved==1).select(db.deals.month, db.deals.num_A.sum(), db.deals.num_B.sum(), db.deals.num_C.sum(), db.auth_user.ALL, left=db.auth_user.on(db.auth_user.id==db.deals.created_by), orderby=db.deals.A|db.deals.B, groupby=db.deals.created_by|db.deals.month ) ERROR: ProgrammingError: ('ERROR', '42803', 'column "auth_user.id" must appear in the GROUP BY clause or be used in an aggregate function') *So I added some code which I thought was irrelevant, but a NEW error sets in:* ###CONTROLLER SECOND ATTEMPT rows = db(db.deals.approved==1).select(db.deals.month, db.deals.num_A.sum(), db.deals.num_B.sum(), db.deals.num_C.sum(), db.auth_user.ALL, left=db.auth_user.on(db.auth_user.id==db.deals.created_by), orderby=db.deals.A|db.deals.B, groupby=db.deals.created_by|db.deals.month|db.auth_user.id ) ERROR: ProgrammingError: ('ERROR', '42803', 'column "deals.num_C" must appear in the GROUP BY clause or be used in an aggregate function') Now I am at a loss, should I keep adding unnecessary fields to groupby? I appreciate help. Thank you! --