Hi, why doesn't work good with first() ? if you do: db(db.table.xx==request.vars.xx).select().first() it will return just the first record, if it doesn't is because the record does not exist.
other way to do this is with limitby: db().select(db.person.ALL, limitby=(0, 2)): http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby-groupby-limitby-distinct-having-orderby_on_limitby-join-left-cache <http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby-groupby-limitby-distinct-having-orderby_on_limitby-join-left-cache> Cheers. El lun., 5 ago. 2019 a las 15:51, Kimus (<[email protected]>) escribió: > Ola , estou tentando fazer uma busca no banco usando db(db.table.id == > request.vars.id).select() > > só que esse select retorna uma lista/rows dai queria saber como retornar > apenas um item, ja tentei usar o .firts() mas não ta funcionando direito > > alguem teria alguma ideia > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/b61ac3fa-7ec5-4268-baaa-e9ad27c9f3f1%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/b61ac3fa-7ec5-4268-baaa-e9ad27c9f3f1%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2Bs%2BuJusH3w7hbYXtbrjxRmR%3DSKzcSQgKnWDj0tbwUWOUKzfwg%40mail.gmail.com.

