Yikes! I *think* I have the same (or functionally the same), but maybe not.
Might it be that I'm using an out-of-date version? Here's what I'm using:
web2py™(1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8),
'stable')PythonPython
2.5.4: C:\Program Files (x86)\web2py\web2py_no_console.exe
I assume the db itself (MySQL) isn't even in play with this problem.
???
On Tuesday, September 11, 2012 9:39:56 AM UTC-6, Massimo Di Pierro wrote:
>
> I cannot reproduce the problem. This works for me:
>
> db=DAL()
> db.define_table('Meet',Field('name'))
> db.define_table('Team',Field('name'))
> db.define_table('Participant_team',
> Field('Meet',db.Meet),
> Field('Team',db.Team))
>
> a=db.Meet.insert(name='here')
> b=db.Team.insert(name='snakes')
> db.Participant_team.insert(Meet=a,Team=b)
> teamStaff = db(db.Meet.id == a).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)))
>
> print teamStaff
>
>
> On Tuesday, 11 September 2012 10:04:25 UTC-5, 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.
>>
>
--