I tried to get a query like:
Select id, round(avg(rating), 2)
>From aTable
Where aId = 11111 and rating > 1
Group by(id);
by the codes:
Criteria crit = new Criteria();
crit.add(aTablePeer.a_ID, 11111);
crit.add(aTablePeer.RATING, 1, Criteria.GREATER_THAN);
crit.addSelectColumn(aTablePeer.ID);
crit.addSelectColumn("ROUND(AVG("+aTablePeer.RATING + "), 2)");
crit.addGroupByColumn(aTablePeer.ID);
List result = aTablePeer.doSelect(crit);
Log.debug("query is " + crit.toString());
However, the above codes caused an exception:
Turbine.handleException: java.lang.Exception:
org.apache.torque.TorqueException: ORA-00933: SQL command not properly
ended
When I checked the debug code, somehow, the codes were interpreted as
SELECT aTable.ID, Round(AVG(aTable.RATING), 2) FROM aTable, AVG(aTable
WHERE aTable.RATING>1 AND aTable.a_ID=11111
How could ", Avg(aTable" append to From clause?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]