This code works in MySQL, SQLite:

db(cond).select(db.carts.ALL, db.c_h.cart_id.count(),
                                    left=db.c_h.on(many_to_many),
                                    groupby=db.carts.id,
                                    orderby=carts_orderby,
                                    limitby = session.carts_limitby)

Gives ORA-00979 error in Oracle:

ORA-00979 not a GROUP BY expression
Cause: The GROUP BY clause does not contain all the expressions in the
SELECT clause. SELECT expressions that are not included in a group
function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must
be listed in the GROUP BY clause.
Action: Include in the GROUP BY clause all SELECT expressions that are
not group function arguments.

Workaround in DAL (tested in MySQL and Oracle):
db(cond).select(db.carts.ALL, db.c_h.cart_id.count(),
                                    left=db.c_h.on(many_to_many),
                                    groupby=db.carts.ALL,
                                    orderby=carts_orderby,
                                    limitby = session.carts_limitby)

But maybe it's better to put into gluon/sql.py for better portability?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to