> db.define_table('team',db.Field('name'))
> db.define_table('match',db.Field('t1',db.team),db.Field('t2',db.team))
> a=db.team.with_alias('a')
> b=db.team.with_alias('b')
> rows=db().select(db.match.ALL,a.name,b.name,left=[a.on
> (a.id==db.match.t1),b.on(b.id==db.match.t2)])
> for row in rows: print row.a,row.b
>
> This generates:
>
> SELECT match.id, match.t1, match.t2, a.name, b.name FROM match LEFT
> JOIN team AS a ON a.id=match.t1 LEFT JOIN team AS b ON b.id=match.t2;

I guess we missed the previous post on with_alias (and it is not in
the manual), nice!.

One thing though, this:
> for row in rows: print row.a,row.b

should be:
for row in rows: print a.name,b.name

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to