Can you try

from gluon.sql import Query
print db(Query(" '%' || NEW.field_1 || '%'  LIKE table_1.field_1
"))._select(db.table_1.field_1)

Do you get the query you want?

On May 7, 10:48 am, AsmanCom <d.as...@web.de> wrote:
> It returns nothing... even if I write in the exact value and it should
> work like a fuzzy logic..
> like that:
>
> find_value= request.vars.value
>
> db('%' + table_1.field_1 +
> '%').lower().like(find_value).select(db.table_1.field_1)
>
> or
>
> db('%' + table_1.field_1 + '%').lower().like('%' + find_value +
> '%').select(db.table_1.field_1)
>
> Any Idea?
>
> On 7 Mai, 17:03, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > This should work
>
> > db("'%' || NEW.field_1 || '%'  LIKE
> > table_1.field_1").select(db.table_1.field_1)
>
> > On May 7, 9:35 am, AsmanCom <d.as...@web.de> wrote:
>
> > > Hi,
>
> > > here is the important Code from an Sqlite trigger i use very often, is
> > > this possible with web2py to?
>
> > > Sqlite:
> > > (SELECT table_1.field_1 FROM table_1 WHERE '%' || NEW.field_1 || '%'
> > > LIKE table_1.field_1 )
>
> > > or i can even do:
>
> > > (SELECT table_1.field_1 FROM table_1 WHERE '%' || NEW.field_1 || '%'
> > > LIKE  '%' || table_1.field_1  || '%'  )
>
> > > w2p:
> > > db.person.name.lower().like(‘m%’)

Reply via email to