Oracle报错:不是GROUP BY 表达式

报错:不是GROUP BY 表达式

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

 

原因:

1、GROUP BY 和 ORDER BY一起使用时,ORDER BY要在GROUP BY的后面

2、ORDER BY 的字段在GROUP BY 后面必须有

3、select需要查询的语句中选中的字段,必须出现在group by子句中

 

posted @ 2016-12-06 13:17  涂山吕吕  阅读(67192)  评论(1编辑  收藏  举报