That does make it a list... temp = [x for x in db(db.tableB.id <http://db.tableb.id/>==row.id).select()] would be more pythonic, no?
On Sunday, April 21, 2013 1:58:51 AM UTC-7, Paolo valleri wrote: > > You get the last element simply because in the loop you have an > assignment. So that you will get only the last element of the loop. > What about that: > > rows = db(db.tableA. <http://db.tableb.id/>id_b==db.tableB.id<http://row.id/> > ).select(db.tableB.ALL) > > or > > temp = [] > for row in rowsA: > temp.append( db(db.tableB.id <http://db.tableb.id/>==row.id).select() > ) > > Paolo > > On Sunday, April 21, 2013 10:28:18 AM UTC+2, BlueShadow wrote: >> >> >> I can't get my head around this problem it's probably easy but I ask >> anyway: >> I got rows(lets call them rowsA) from tableA and I want to select all >> items from another tableB which have one of the ids in tableA >> I could do it with a for loop selecting one at a time like so: >> for row in rowsA: >> temp=db(db.tableB.id <http://db.tableb.id/>==row.id).select() >> >> but now I got only one element as a result. >> how can I get all those into one variable:rowsB >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.