I was wrong, here is working example: list_of_ids = [i.id for i in db1(db1.tablename.id>0).select(db1.tablename.id )] rows = db2(db2.tablename.id.belongs(list_of_ids)).select()
Is this what you want? Marin On Wed, Jul 4, 2012 at 1:25 PM, KMax <[email protected]> wrote: > My goal to do > select * from table_name where id IN (1,2,3,4,5,6) > > > The sample shows what I need to do. Sure code is invalid. > (1,2,3,4,5,6) - is a list from first DB. > > For now I am building in a loop huge where clause > (id =1 ) OR (id=2) OR .... OR (id=100500) > > среда, 4 июля 2012 г., 17:38:28 UTC+7 пользователь Marin Pranjić написал: > >> You cannot join tables that are not in the same database. >> >> You can do: >> >> list_of_ids = db1(...).select(db1.tablename.**id<http://db1.tablename.id> >> ).as_list() >> >> db2(db2.tablename.id.belongs(**list_of_ids)).select() >> >> >> Marin >> >> On Wed, Jul 4, 2012 at 12:28 PM, KMax <[email protected]> wrote: >> >>> Hello, >>> Is any way to query subj with DAL sintax? >>> I am using two databases, and I want select from second one few rows >>> according to result of select from first database. >>> >>> I think this will not work. >>> db1(db1.tablename.id==db2.tabl**ename.id).select() >>> >>> Thanks in advance >>> -- >>> Maxim >>> >> >>

