is it possible to sum() with left, groupby, orderby?
i've tried before no error occured but the result is not expected
*e.g.*
from_date = datetime.datetime.strptime(request.args(0), '%Y-%m-%d').date()
to_date = datetime.datetime.strptime(request.args(1), '%Y-%m-%d').date()

table_header = db.do_header
table_detail_0 = db.do_product_detail
table_detail_1 = db.do_stock_detail

query_table_header = ((table_header.do_date >= from_date) & 
 (table_header.do_date <= to_date) )

orderby = ~table_header.id
groupby = table_detail_1.stock
left = [table_detail_0.on(table_header.id == table_detail_0.do_no), 
table_detail_1.on(table_header.id == table_detail_1.do_no) ]

rows_do_per_do = db(query_table_header).select(orderby = orderby, 
  groupby = groupby, 
  left = left)

sum = db.table_detail_1.quantity.sum()

#db().select(sum, orderby = orderby, groupby = groupby, left = 
left).first()[sum]
#db().select(sum, groupby = groupby, left = left).first()[sum]
db().select(sum, left = left).first()[sum]

thanks and best regards,
stifan

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