Try to print the sql generated from web2py: print db(db.ntw_edge.outID==1147)._select(left=db.ntw_edge.on(db. ntw_edge.inID==alias_edge.outID))
On Thu, Jun 9, 2016 at 10:10 AM, 'Annet' via web2py-users < [email protected]> wrote: > I have the following SQL query (in Postgresql): > > > SELECT ntw_edge.outid, ntw_edge.inid, ntw_edge.label, alias_edge.inid, > alias_edge.outid, alias_edge.label > FROM ntw_edge > LEFT OUTER JOIN ntw_edge AS alias_edge > ON ntw_edge.inid=alias_edge.outid > WHERE ntw_edge.outid=1147; > > > In web2py I have: > > def retrieve_edge(): > alias_edge = db.ntw_edge.with_alias('alias_edge') > rows = > db(db.ntw_edge.outID==1147).select(left=db.ntw_edge.on(db.ntw_edge.inID==alias_edge.outID)) > return dict(rows=rows) > > > The SQL query returns the right records: > > 1147 549 registered 1147 549 registered > 1147 1149 registered > > The web2py query returns only 1 record: > > 1147 549 registered 1147 549 registered > > > Why doesn't the web2py query return the correct result? > > > Kind regards, > > Annet > > -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- Massimiliano -- 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]. For more options, visit https://groups.google.com/d/optout.

