thanks for the clarification

On Jan 28, 3:44 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> db(a) is a set
>
> db(a)(b) is a subset
>
> db(a)(b)(c) is a subset of the subset etc.
>
> db(a)(b)(c).select(left=table.on(d)) is a join
>
> notice that table.on(d) is not a set, but a condition (that is why it
> is on the right hand side, not the left hand side).
>
> a,b,c,d etc can be expressions like (q1)&(q2) or (q1)|(q2) etc.
>
> Massimo
>
> On Jan 27, 5:05 pm, Baron <richar...@gmail.com> wrote:
>
> > 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