db(db.table.id.belongs(myset)).select()

Il giorno mercoledì 19 dicembre 2012 10:07:33 UTC+1, Rocco ha scritto:
>
> Dear all,
>
> I need to extract multiple records from a table, the number of selected 
> records is variable (from 1 to hundreds).
>
> The user form returns a list of selected ids, f.e.:
> myset=[1,15,22,44,56]
>
> In the raw sql way, I used a for loop to generate the where clause of the 
> sql statement, to get f.e.:
>
> SELECT * from table
> WHERE (id=1 or id=15 or id=22 or id=44 or id=56)
>
> I expected to find some DAL tool to avoid the db.executesql usage, but I 
> wasn't able to do it.
>
> I hoped that I could pass the list as argument, in this way:
>
> db(db.table.id==myset).select()
> but doens't work...
>
> any suggestions?
>

-- 



Reply via email to