Error: not a GROUP BY expression

 

 

oracle database: group by the back must add all the fields behind you select all the queries in addition to the aggregate functions.

 

Solution: put the group by using sub-queries or all queries into the field behind the select group by post.

 

Error: not a GROUP BY expression

实例:select sum(hwjz),rq from JcChargeInfo where 1=1  group by rq order by jcchargecode desc

 

the reason:

1, when used with the GROUP BY and ORDER BY, ORDER BY GROUP BY to the behind.

2, ORDER BY columns must be behind the GROUP BY

3, selected in the select statement needs to query fields must appear in the group by clause

Guess you like

Origin www.cnblogs.com/zhaoyanhaoBlog/p/12155144.html