This was explained here:
http://groups.google.com/group/web2py/browse_thread/thread/6824af4b8a0e1762

Mind that you need 1.54 posted today since there was a bug.

Massimo

On Dec 11, 4:36 pm, michal niklas <[email protected]> wrote:
> How can I do in DAL query such as:
>
> select persons.person, a.name, b.name from votes
> join persons on(votes.person=persons.id)
> join gifts as a on (a.id = gift1)
> join gifts as b on (b.id = gift2)
>
> There are 3 tables:
> persons (person varchar)
> gifts (name varchar)
> votes (person_id, gift1_id, gift2_id)
>
> The best I was able to to in DAL is:
>
> votes = db(db.votes.person_id==db.persons.id).select()
> for vote in votes:
>         person_name = vote.persons.person
>         gift1_rec = db(db.gifts.id==vote.votes.gift1_id).select()
>         gift2_rec = db(db.gifts.id==vote.votes.gift2_id).select()
>         ...
>
> I would like to do it in one step just like in SQL.
> Is it possibe?
>
> Regards,
> MichaƂ Niklas
--~--~---------~--~----~------------~-------~--~----~
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