fla1=db.favor.with_alias('fla1') fla2=db.favor.with_alias('fla2') db(db.ice_cream.f1==fla1.id)(db.ice_cream.f2==fla2.id).select (db.ice_cream.id,fla1.name,fla2.name)
On Aug 10, 2:59 am, Richard <richar...@gmail.com> wrote: > hello, I have something like the following tables: > > db.define_table('flavor', > db.Field('name'), > ) > > db.define_table('ice_cream', > db.Field('f1', db.flavor), > db.Field('f2', db.flavor), > ) > > I am trying to form a query that will return all the ice creams with > the name of each flavour. Note that sometimes the ice cream will have > just 1 flavor so f2 will not be set. > How would I do this in a single query? > > thanks, > Richard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---