It worked Jim. Thanks! On Friday, November 27, 2020 at 11:18:32 AM UTC-8 Jim S wrote:
> If your groupby is a list of fields then it needs list brackers [ ] around > it. > > Can you add that and report back? > > -Jim > > On Friday, November 27, 2020 at 2:01:17 AM UTC-6 alexg...@gmail.com wrote: > >> using Postgres >> >> On Thursday, November 26, 2020 at 11:18:00 PM UTC-8 Alex Glaros wrote: >> >>> How to add db.role_member.id within select clause as highlighted below? >>> >>> If I leave it out, it runs fine. If I add it, I get error: >>> class 'psycopg2.errors.GroupingError'> column "role_member.id" must >>> appear in the GROUP BY >>> >>> and if I make it appear in the group by section as suggested by the >>> error message, I get error: >>> SyntaxError: non-keyword arg after keyword arg >>> >>> Here is the code: >>> >>> distinctCount = >>> db.object_super_object.super_object_fk.count().with_alias('distinctCount') >>> >>> distinctSet = db((db.role_member_status_instance.role_member_fk == >>> db.role_member.id) & (db.role_member.role_fk == specificRoleID) & >>> (db.role_member.object_super_object_fk == db.object_super_object.id) & >>> (db.role_member.is_active == True) & >>> (db.role_member.member_super_object_fk == db.super_object.id) & >>> (specificOrganizationID == >>> db.object_super_object.role_owner_organization_fk)).select(db.role_member.member_super_object_fk, >>> >>> db.role_member.id, distinctCount, groupby = >>> db.role_member.member_super_object_fk, db.role_member.id) >>> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/03fd1332-1dab-47a9-9dd5-4ac0212e2fddn%40googlegroups.com.