The best you can do is create a dictionary d={1:'name1', 2:'name2', 3:'name3'} #where 1,2,3 are id in tmp table
db(db.material_issue.product_id.belongs(d.keys())).select (db.material_issue.product_id,db.material_issue.issued_qty) for row in rows: print row.product_id, d[row.product_id], row.issued_qty Massimo On Jul 30, 5:09 am, phneoix <neo.stea...@gmail.com> wrote: > thanks for the suggestion > > this is what iam trying to achieve > > db > (db.material_issue.product_id==created_temporary_table.product_id).select > (db.material_issue.product_id,created_temporary_table.name,db.material_issue.issued_qty) > > On Jul 29, 11:21 am, Fran <francisb...@googlemail.com> wrote: > > > On Jul 29, 3:14 pm, phneoix <neo.stea...@gmail.com> wrote: > > > > i hope iam not confusing you guys. > > > No, this is very clear & makes sense. > > > My first thought would be to merge all the lookup tables into 1 & add > > a 'type' column, but I guess you can't do that? > > > Temporarytables aren't always > > recommended:http://www.sql-server-performance.com/articles/per/derived_temp_table... > > > How about doing something like using a dictionary to store > > thetemporarytablein: > > > mystorage = {} > > lookup_tables = [endmills, gauging, etc] > > for lookup_table in lookup_tables: > > rows = db(db[lookup_table].id>0).select() > > for row in rows: > > mystorage[row.product_id] = row.product_name > > > Then instead of doing the Join with the material issuetable, just do > > a lookup in the dict... > > > F --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---