Hi,

you can do:
array = [1,3,6]
db(db.tablename.fieldname.belongs(array)).select(db.tablename.ALL)

On Sun, Aug 7, 2011 at 3:05 PM, guruyaya <guruy...@gmail.com> wrote:
> Hi guys.
> Is there a way to use a SELECT... IN... syntax in dal? Something like
> "SELECT * FROM auth_user WHERE id IN (1,3,6)
> If not, I'll explain my use case, and hope to get your best answer.
>
> I have 2 dbs, one holds auth_user, the other holds some data (projects
> in this case), with the id of the user that created it. After
> selecting the all projects, I wanted to show who created them. I
> cannot use join, because they don't sit on the same database (and they
> cannot sit on the same database). My 2nd option, is to create an
> array, of all the users that created project, and match username with
> it's creator. That's not that bad, but I don't know how to use SELECT
> IN in dal. The 3rd option, is to query for each user. That makes me
> want to die, jst so I can roll in my grave. It creates so many unneded
> queries. On the other hand - that's excatly what I do, as the other
> options are immpossible, from where I stand.
>
> Any ideas?
>
> Thanks
> Yair
>

Reply via email to