hql语句
select attendUserName,sum(case when attendTypeId = '1' then 1 else 0 end) [迟到],sum(case when attendTypeId = '2' then 1 else 0 end) [缺勤],sum(case when attendTypeId = '3' then 1 else 0 end) [早退] from AttendanceManageEntity group by attendUserName而我的AttendanceManageEntity实体对象只有attendUserName,没有早退,迟到,缺勤这些对象,所以结果集只有attendUserName的结果。
请问如果查询到我需要的结果集里有:
attendUserName,迟到,缺勤,早退
select attendUserName,sum(case when attendTypeId = '1' then 1 else 0 end) [迟到],sum(case when attendTypeId = '2' then 1 else 0 end) [缺勤],sum(case when attendTypeId = '3' then 1 else 0 end) [早退] from AttendanceManageEntity group by attendUserName而我的AttendanceManageEntity实体对象只有attendUserName,没有早退,迟到,缺勤这些对象,所以结果集只有attendUserName的结果。
请问如果查询到我需要的结果集里有:
attendUserName,迟到,缺勤,早退
解决方案 »
- 严重: Dispatcher initialization failed
- JAVA移位运算符
- 关于读取磁盘数据的问题
- 关于java反射的一道题
- 求一个velocity实例!要JAVA项目,不要有servlet的!(谢谢各位了,有例子的一定给20分以上)
- 请问怎样让JAR包在后台运行?就是我把SSH窗口关闭后没有影响
- tomcat正常运行的东西放到sun application server7.0里面错的一塌糊涂,连个包都找不到?还有救吗?那些类库应该放哪里WEB-INF下没用,要
- (Cookie)的问题
- 当我CREATE SESSION得时候,weblogic是否会自动创建COOKIE
- 有关Jbuilder8的光标定位问题
- 现在有一个String型的数组,如何把其中的某项数据去掉?
- OpenLayers如何把googleMaps添加到geoserver显示的地图中
attendUserName 早退 迟到 缺勤
甲 1 5 0
乙 3 1 2
而现在查到的只有
attendUserName
甲
乙
没测试过 如果你sum 没问题的话应该可以!! 只是取 别名而已