Oh, no problem, I've adjusted it for my case. My problem was that I wasn't aware about subqueries (_select vs. select), so that was the main take away :)
On Wed, May 15, 2019, 1:28 AM Massimo Di Pierro <[email protected]> wrote: > Something is wrong. You are searching that the id of one table is not the > id of another table. But that is not a reference. > > On Tuesday, 14 May 2019 19:49:32 UTC-7, Vlad wrote: >> >> works like a charm! >> thank you ! >> >> On Tue, May 14, 2019 at 7:16 PM Val K <[email protected]> wrote: >> >>> should help: >>> >>> sql_str = db()._select(db.tbl2.id) #note underscore before `select` >>> db(~db.tbl1.id.belongs(sql_str)).select(db.tbl1.id, db.tbl1.name) >>> >>> >>> >>> >>> >>> >>> On Wednesday, May 15, 2019 at 1:06:49 AM UTC+3, Vlad wrote: >>>> >>>> What would be an equivalent of the following? >>>> >>>> SELECT ID, Name >>>> FROM Table1 >>>> WHERE ID NOT IN (SELECT ID FROM Table2) >>>> >>>> -- >>> 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 a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/web2py/B1zikfQE8GI/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/web2py/e1e7ba43-70bd-4dc1-8029-21d0959cd023%40googlegroups.com >>> <https://groups.google.com/d/msgid/web2py/e1e7ba43-70bd-4dc1-8029-21d0959cd023%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/B1zikfQE8GI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/09fc266e-ebd0-4920-9a9b-bdd68caba1d4%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/09fc266e-ebd0-4920-9a9b-bdd68caba1d4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CABZ%2BKCARx7BeV0925vgwHPxNQvG%2B5C%3DcrTnDnmViQeXK6trSpQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

