thanks Massimo - that works.
Previously I had tried db.sales.on(db.sales.name==db.item.name)
(db.user.name=='bob') but it caused an error.
Do you know in what cases this form is allowed?

Baron


On Jan 27, 5:23 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> this should work
>
> db().select(db.item.name,db.sales.price,left=db.sales.on
> ((db.sales.name==db.item.name)&(db.user.name=='bob'))
>
> Massimo
>
> On Jan 27, 12:06 am, Baron <richar...@gmail.com> wrote:
>
> > hello, I'm having difficulty making restrictions to a left outer
> > join.
>
> > I have these tables:
> > Item: name
> > Sale: name, user, price
>
> > I want to select all the items with the prices of any sales for the
> > current user.
> > For example, given this data:
>
> > Items:
> > apple
> > banana
> > orange
>
> > Sales:
> > apple,bob,1
> > apple,bill,0.5
> > orange,bob,3
>
> > For bob I want to show:
> > apple,1
> > banana,
> > orange,3
>
> > To do the left join I use:
> > db().select(db.item.name, db.sale.price, left=db.sale.on(db.item.name
> > == db.sale.name))
> > Is there a way I can restrict this query to join for just a certain
> > user?
>
> > thanks, Baron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to