In Oracle Library: all fields except aggregate function queried after select must be added after group by
Solution: put group by into the sub query or put all query fields after select into group by
Error: not group by Expression
Instance: Select sum(hwjz),rq from JcChargeInfo where 1=1 group by rq order by jcchargecode desc
Reason:
1. When group by and order by are used together, order by should follow group by
2. The field of order by must be followed by group by
3. The fields selected in the select statement to be queried must appear in the group by clause