Yes I can confirm this (nested select)::

    address_rows = db(db.address.address == 
user.address)._select(db.address.id)
    assert 1 == len(address_rows)
    customer_rows = 
db(db.customer.address_list.belongs(address_rows)).select()
    assert 1 == len(customer_rows)

The first assert would be 1 == 83 ( a large number). The second assert 
would be 1 == 0 (no customer rows).  However (not a nested select)::

    address_rows = db(db.address.address == 
user.address).select(db.address.id)
    assert 1 == len(address_rows)
    customer_rows = 
db(db.customer.address_list.belongs(address_rows)).select()
    assert 1 == len(customer_rows)

gives correct answer.
On Monday, October 11, 2021 at 2:26:01 AM UTC-7 黄祥 wrote:

> nested_select = db(db.address.address.contains('boulevard') ).*_select*(
> db.address.id)
> *result in browser *
> SELECT "address"."id" FROM "address" WHERE (LOWER("address"."address") 
> LIKE '%boulevard%' ESCAPE '\');
>
> rows = db(db.customer.address.belongs(nested_select) ).select()
> *result in browser*
> nothing (no error occured but the resuls is not expected)
>
> select = db(db.address.address.contains('boulevard') ).*select*(
> db.address.id)
> *result in browser (only this work as expected)*
> return db.address.id
>
> any idea ?
>
> thanks
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/cdb59e91-3f0f-43b7-8cd2-6e6322b1efd9n%40googlegroups.com.

Reply via email to