The double db reference was definitely part of the problem but wasn't the whole story.
I made a mistake in one of the field names... specifically AND (task.*task_status* = 'BILLABLE') should have been AND (task.*payment_status*="BILLABLE")); I actually had it correct in the SQL code above because I didn't use copy and paste for that. Then I looked over some of joecodeswell has references for info about joins https://joecodeswell.wordpress.com/web2py-notes/#Validators (cant get the editor to remove the formatting on this or create the link as I did above?) Then I took a break from the small screen and went to the big screen and found a youtube video by Giovanni Barillari called pyDal a pure database abstraction layer <https://www.youtube.com/watch?v=tkxExOXAeZw> it's still sitting there paused at 22:52 where it hints at the final part of my solution. So after much playing around I got to this def generate_inv_details(): session.inv_details = [] session.inv_total = 0 session.inv_record_count=0 today = datetime.date.today() query=db(db.task.person.belongs(session.company_persons)) rows = query( (db.task.start_time <= today) & (db.task.charge_to=='COMPANY') & (db.task.payment_status=='BILLABLE'))\ .select(db.task.person, db.person.id, db.person.name, db.person.referrer_ref, db.task.title, db.task.start_time, db.task.duration, db.task.task_type, db.task.task_status, db.task.charge_to, db.task.charge, db.task.payment_status, left=db.person.on(db.person.id==db.task.person) ) session.inv_details=rows for row in session.inv_details: session.inv_record_count += 1 session.inv_total += row.task.charge and IT WORKS! I can call anything I want from the person table. Many thanks for your responses Anthony, without you guys I might as well be looking into a hedge! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.