That particular query cannot be built with DAL but you can obtain the same 
result with a single query and 

db(....).select(groupby=(db.contracts.contractno, 
db.customerlist.customer_id),having=(db.customer_comment.customer_id.count()>123))


On Monday, 28 April 2014 21:36:10 UTC-5, DucVa wrote:
>
> Hi all,
> I want build a query that can select from result of query other select. 
> Like example:
>
> *SELECT **
> *FROM(*
> * SELECT  Contracts.ContractNo, CustomerList.CustomerId,*
> * COUNT(customer_comment.customer_id) AS Quantity*
> * FROM Contracts, customer_comment, CustomerList*
> * WHERE (((customer_comment.del_flag = 0)*
> * AND (customer_comment.customer_id = CustomerList.CustomerId))*
> * AND (Contracts.CustomerId = CustomerList.CustomerId))*
> * GROUP BY Contracts.ContractNo, CustomerList.CustomerId*
> *) AS A*
> *WHERE **Quantity **> 123*
>
> I want to to with DAL, not use executesql()
>
> Best Regard!
>

-- 
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.

Reply via email to