[Err] ORA-00979: not a GROUP BY expression
来源:互联网 发布:淘宝正道体育假货 编辑:程序博客网 时间:2024/05/16 07:27
最近在按照用户统计其完成的任务量与总任务量,在用group by是遇到了这个错误,错误的sql如下:
select q.CHECK_MAN_ID checkManId,u.USER_ALIAS,count(*) total,sum(CASE WHEN q.QUOTA_USER_STATUS='finished' THEN 1 ELSE 0 END) finishedfrom IF_QUOTA_USER q,WM_BASE_USER uwhere u.USER_ID = q.CHECK_MAN_IDGROUP by q.CHECK_MAN_ID
后来查到原因好像是group by后要把所有的查询字段写下来;即要把u.USER_ALIAS也写在group by 后
正确的语句:
select q.CHECK_MAN_ID checkManId,u.USER_ALIAS,count(*) total,sum(CASE WHEN q.QUOTA_USER_STATUS='finished' THEN 1 ELSE 0 END) finishedfrom IF_QUOTA_USER q,WM_BASE_USER uwhere u.USER_ID = q.CHECK_MAN_IDGROUP by q.CHECK_MAN_ID,u.USER_ALIAS
查询结果:
阅读全文
0 0
- [Err] ORA-00979: not a GROUP BY expression
- ORA-00979: not a GROUP BY expression
- ORA-00979: not a GROUP BY expression报错处理
- System.Data.OracleClient.OracleException: ORA-00979: not a GROUP BY expression
- [Err] ORA-00979: 不是 GROUP BY 表达式
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated..
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
- [Err] ORA-01791: not a SELECTed expression 数据库错误 的原因与解决
- hive:Group by 问题:Expression Not In Group By Key
- ORA-01791:not a SELECTed expression
- ORA-01791:not a SELECTed expression 处理
- ORA-01791:not a SELECTed expression
- ORA-01791:not a SELECTed expression 处理
- hive中group by 提示Expression Not In Group By Key的解决办法
- Hive(十三)--Group by 问题:Expression Not In Group By Key
- ORA-00979 不是group by 表达式 .
- JDK自带小工具汇总
- python assert的作用
- 01背包
- frame框架
- 【Machine Learning】通过网格搜索进行调参
- [Err] ORA-00979: not a GROUP BY expression
- 【OpenCV3图像处理】查找二值图像的边缘 函数findContours()详解
- 洛谷 P1013 进制位
- *c#在64位上编写32位程序时注册表重定向的问题解决办法**
- Python中sorted函数的用法
- Native/Hybrid/Web App
- 端口
- AVL树的进一步实现
- C++宏定义详解