it's kinda unclear what you want from the posted snippet, however your original snippet would fail because of an invalid syntax (you can't do row.update_record(something-=1), no matter what)
from my pov, you asked for something able to decrease a column value of a preselected row by 1, and that is accomplishable with
row.update_record(something=row.something-1)
the second snippet suggested
effectiveSize = db(
db.groups.id==session.groupID).count()
just counts how many
groups.id are there with session.groupID as value.
So, you can do
row=db(
db.groups.id==session.groupID).select(db.groups.effectiveSize).first()
if row:
row.update_record(row.effectiveSize-=1)
or
count=db(
db.groups.id==session.groupID).count()
if count:
row=db(
db.groups.id==session.groupID).select(db.groups.effectiveSize).first()
row.update_record(effectiveSize-=1)
to have the same result, but you're just adding an unneccessary query.
If you plan to have a lot of groups the speed wouldn't matter in this case, cause
groups.id is a primary key and your query either returns 1 row or 0 row. Counting or selecting will end up doing the same thing in more or less the same time, cause the biggest "operation" on a large scale table with that query would be the "filtering" part, the one in common with both methods,
db.groups.id == session.groupID
A shorter version of a working snippet can also be
db(
db.groups.id==session.groupID).update(effectiveSize=db.groups.effectiveSize-1)
in which case, if a group row is found it will get decreased, if not, nothing will happen.