Hi all
Emphasize on group by clause, are there alternative to following query (where all cat attributes are explicitly specified)?
catList = db.find("select cat, sum(weight) from cat in class eg.Cat where cat.color='white' group by cat.id, cat.birthdate, cat.color, cat.sex, cat.weight");
Quite a few occasions I am required to return the object itself with the aggregate values and the object can have more than 10 attributes easily.
I also noted that following query work fine in MySQL but not in Oracle as Oracle require every displayed column to be specified in group by clause.
catList = db.find("select cat, sum(weight) from cat in class eg.Cat where cat.color='white' group by cat.sex");
|