Re: [web2py] Re: Left join with filters on joined table

2018-11-25 Thread David Orme
Thanks, I hadn't realised that db.table.on() could be passed more complex queries. I'd tried feeding a list of queries - the online book mentions that left= can take an iterable - but each list item creates a separate left join statement. Being able to pass a single query including qualifiers

Re: [web2py] Re: Left join with filters on joined table

2018-11-24 Thread Val K
Try to move db.audio.start_time > '12:00:00' in the left join ON: left=db.audio.on((db.audio.site_id == db.sites.id) & (db.audio.start_time > '12:00:00')) On Sunday, November 25, 2018 at 1:34:54 AM UTC+3, David Orme wrote: > > Thanks for the suggestion. I've actually tried that and get exactly

Re: [web2py] Re: Left join with filters on joined table

2018-11-24 Thread David Orme
Thanks for the suggestion. I've actually tried that and get exactly the same results - I read somewhere that using an empty db() could be problematic, so tried both. It doesn't affect the result without any audio queries, but any audio queries added into the selected set (qry in my code), cause th

[web2py] Re: Left join with filters on joined table

2018-11-24 Thread Val K
try remove db.sites from query (just db().select(...)) db(db.sites) is shortcut for db(db.sites.id>0) which turns into WHERE (( sites.id IS NOT NULL) On Sunday, November 25, 2018 at 1:00:56 AM UTC+3, David Orme wrote: > > Hi, > > I've got a table 'sites' and a table 'audio', where sites.id =