db(db.name.like('%alex%)).select()

On Apr 10, 4:04 pm, "web2py <<<at>>> technicalbloke.com"
<technicalbl...@googlemail.com> wrote:
> I can't seem to find a clear example of using 'like' in database
> selects.
>
> I'd like to do something like...
>
> SELECT * FROM `customers` WHERE customer.name LIKE "%alex%" LIMIT 10;
>
> ...but without resorting to executing the query directly via
> db.executesql(). The manual says...
>
> "You can build a query (using operators like ==, !=, <, >, <=, >=,
> like, belongs) and store the query in a variable q
>
> >>> q=name=='Alex'"
>
> ... so I know it's in there but I just don't see how 'like' and
> 'belongs' fit into that syntax: q=namelike'Alex' makes no sense
> surely. I'd be very grateful if someone could enlighten me as to the
> correct grammar.
>
> Cheers :)
>
> Roger.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to