My mistake:

max_id = db(db.table).select(db.table.id.max()).first()
[db.table.id.max()]
and
db(db.table.id==max_id).update(field='avariable')

On May 28, 10:23 am, Massimo Di Pierro <[email protected]>
wrote:
> max_id = db(db.table).select(db.table.id.max())
> and
> db(db.table.id==max_id).update(field='avariable')
>
> or
>
> db(db.table.id.belongs(db(db.table)._select(db.table.id.max())).update(fiel 
> d='avariable')
>
> but you should not count on id being sequential. That is not true on
> GAE and it is not true for other NoSQL which we partially support. You
> should use a datetime timestemp.
>
> On May 28, 3:22 am, Blackpainter <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > im pretty new to web2py and encountered a little problem.
> > i need to find the highest ID in my table ( which through other
> > threads i
> > already accomplished) and update another field in this entry with an
> > variable.
> > (db.table.insert(field=db.table.field.store(request.body,'picture.jpg'))
>
> > i started with:
> > db.executesql(""" UPDATE table SET field='*variable*' WHERE id=(SELECT
> > MAX(id) FROM table)""")
>
> > but kinda reached a dead end as its probably not possible to include
> > my
> > variable in the executesql command.
> > The Variable comes from a flash application, which takes a webcam foto
> > and
> > accesses a function in web2py.
> > plz, help, cant help myself :/
>
> > Your newbie,
> > Blackpainter

Reply via email to