select sum(case when CheckStatus = 4 then 1 else 0 end ) from BasTimecard bt 没错
select bt.EmployeeName from asTimecard bt group by bt.EmployeeName 也没错select bt.EmployeeName ,sum(case when CheckStatus = 4 then 1 else 0 end ) from BasTimecard bt group by bt.EmployeeName 就报错了。。请问该怎么写
sum里面的CheckStatus改成bt.CheckStatus也是错。
select bt.EmployeeName from asTimecard bt group by bt.EmployeeName 也没错select bt.EmployeeName ,sum(case when CheckStatus = 4 then 1 else 0 end ) from BasTimecard bt group by bt.EmployeeName 就报错了。。请问该怎么写
sum里面的CheckStatus改成bt.CheckStatus也是错。
解决方案 »
- Spring怎么给类中静态变量注入值??
- 文件上传
- jsp 链接 数据库 怪现象
- 再findForward就报错的问题
- java.lang.ClassNotFoundException: org.apache.ws.security.transform.STRTransform
- TONGWEB+JSP+ORACLE环境,ORACLE双网卡,连接不稳定,请教:
- 讨论,计算机学习有没有标准,我们是否面临信息时代的知识爆炸 顶者有分
- (急)请高手指教:我们的系统需要不断的刷新数据库,来实时显示新的消息,这样在并发的时候数据库压力会很大,不知道有什么好的办法解决性
- 在struts中actionforms这一名词该如何解释
- Spring Boot linux 服务器启动配置JDK
- 查找不到cxf做的webservice
- 请教了:ibatis怎样查询某个时间范围内的记录?
select bt.EmployeeName,sum( Case when bt.CheckStatus = 4 then 1 else 0 end ) from BasTimecard bt group by bt.EmployeeName
就报
"Could not execute query"
{"ORA-00907: 缺失右括号"}
?不太懂
----------
其中的EmployeeName ,sum中间是中文输入状态的逗号.
----------
BasTimecard bt
asTimecard bt
这不是2个表么?
---------------
如果排除以上2个,这个sql肯定没有问题。
再不不行就外面加一个 select * from (select bt.EmployeeName,sum( Case when bt.CheckStatus = 4 then 1 else 0 end ) from BasTimecard bt group by bt.EmployeeName )
那么注意属性的大小写
试试select bt.employeeName ,sum(case when bt.checkStatus = 4 then 1 else 0 end ) from BasTimecard bt group by bt.employeeName
不过还是觉得奇怪,用CreateQuery 的时候为什么上面两个查询分开就可以执行,拼到一起就出问题了。。