That look right... There ways to write request in web2py when it comes to join. They will not generate the same SQL syntax for example :
db((db.table1.field==something)&(db.table2.field==something)).select(...) = Old SQL SELECT ... FROM table1, table2 WHERE ... When you use join in web2py, I guest it will use new SQL : SELECT ... FROM table1 JOIN ON table2... WHERE ... I never check... But works and if you get out what you want form you web2py select who cares the way the SQL is writed finally if it get executed... :) Richard On Tue, Sep 11, 2012 at 11:25 AM, MichaelF <mjfs...@gmail.com> wrote: > I should have added that I can get the same effect with this: > > # In this example, Meet and Team are being connected through > Participant_team > teamStaff = db(db.Meet.id <http://db.meet.id/> == request.args(1)).select( > db.Meet.ALL, db.Team.ALL, > join = [db.Participant_team.on( > db.Participant_team.Meet == > db.Meet.id<http://db.meet.id/> > ), > db.Team.on(db.Participant_team.Team == > db.Team.id<http://db.team.id/> > )]) > > > On Tuesday, September 11, 2012 9:04:25 AM UTC-6, MichaelF wrote: >> >> Section 6.21.1 in the manual talks about an alternative syntax for 1-many >> joins, using the 'on' function. Is that technique available for many-many? >> I try this and get an error: >> >> # In this example, Meet and Team are being connected through >> Participant_team >> teamStaff = db(db.Meet.id == request.args(1)).select( >> db.Meet.ALL, db.Team.ALL, >> join = db.Team.on( >> (db.Participant_team.Meet == db.Meet.id) & >> (db.Participant_team.Team == db.Team.id))) >> >> The error is: "Unknown column 'Meet.id' in 'on clause'" >> >> I can change "db.Team.on" to "db.Participant_team.on", but I get the same >> error. >> >> I have a lot of other JOINs that I must do, but this is the smallest >> example that shows the problem. >> > -- > > > > --