Thank you guys, I sort of zeroed in on the solution from your replies.
Little by little I am learning how things are done in web2py. :)
tblBalias = db.skedp.with_alias('tblBalias')
desired_result = db(db.tblB.fkA == 1).select(db.tblB.name,
db.tblB.data, tblBalias.data,
left = tblBalias.on( (tblBalias.name == db.tblB.name) &
(tblBalias.fkA == 2) ) )
Massimo, tblA is just a backgrounder to explain the fkA in tblB.
A follow-up question: is it more efficient to use,
left = tblBalias.on( (tblBalias.fkA == 2) & (tblBalias.name ==
db.tblB.name) )
instead of,
left = tblBalias.on( (tblBalias.name == db.tblB.name) &
(tblBalias.fkA == 2) ) )
?
It is expected that (tblBalias.fkA == 2) has far less results than
(tblBalias.name == db.tblB.name) .