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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to