On Mon, Feb 2, 2009 at 6:40 PM, andrei <[email protected]> wrote:
>
> I need to do this type of query, and provide list argument:
>
> SELECT * FROM table WHERE id IN (value1, value2, value3)
>
> result = list(db.select('table', dict(values=sqllist(values)),
> where="id in ($values)"))
>
> The only way i managed to do it was using sqllist( values ), and
> values should be of string type.
Looks like sqllist is not for that purpose.
Here is the right way to do it.
>>> db.select('table', where=web.sqlors('id =', [1, 2, 3]), _test=True)
<sql: 'SELECT * FROM table WHERE (id =1 OR id =2 OR id =3 OR 1=2)'>
> Shouldn't it be supported by default?
I think it should. Even I was troubled by this couple of times.
Let me see if it is easy to support that.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---