Complex SQL Query - Left Out Join With A Third table...

10 views
Skip to first unread message

Yannick

unread,
Nov 24, 2009, 11:26:43 PM11/24/09
to web2py-users
Hello mate,
Let's said for example I have the following:

rows = db().select(db.table_A.first_name, db.table_B.email,
db.table_B.ID,
left=db.table_B.on
( db.table_A.ID = db.table_B.FK) )

NOW I want to do another left OUTER JOIN of the table from <rows>
with a third table "table_C" on a condition "db.table_B.ID =
db.table_C.ID"
How can I do that ?


Thanks for your help,

Cheers,
Yannick P.


mdipierro

unread,
Nov 25, 2009, 9:00:33 AM11/25/09
to web2py-users
Yes.

left=(db.table_B.on(db.table_A.ID = db.table_B.FK)),
db.table_C.on(db.table_A.ID = db.table_C.FK)))

Yannick

unread,
Nov 26, 2009, 7:42:16 AM11/26/09
to web2py-users
Thanks Massimo,
I just wonder, I do know that is possible to see the SQL Query by
using _select()... I was wondering if there opposite operation ? Like
if is possible to write the SQL query and see DAL code of web2py ?

Thanks,
Yannick P.

mdipierro

unread,
Nov 26, 2009, 8:24:14 AM11/26/09
to web2py-users
Sorry no.
Reply all
Reply to author
Forward
0 new messages