博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hql中不能写count(1)能够写count(a.id)
阅读量:7194 次
发布时间:2019-06-29

本文共 852 字,大约阅读时间需要 2 分钟。

hql中不能写count(1)能够写count(a.id)里面写详细的属性

 

String hql="select new com.haiyisoft.vo.entity.cc.repo.BusinessStat(  r.paramName ,t.paramName , "

         +" (select nvl(count(1),0) "
         +" from com.haiyisoft.entity.cc.busi.Business b,com.haiyisoft.entity.cc.busi.Application a,com.haiyisoft.entity.cc.busi.Channel c "
         +" where b.applicationId=a.id and a.appChannel=c.id "
         +" and b.servTime>=to_date('" + bgTime + "','yyyy-mm-dd HH24:mi:ss')"
         +" and b.servTime<=to_date('" + edTime + "','yyyy-mm-dd HH24:mi:ss')"
         +" and c.channelCode=r.paramCode and substr(b.busiType,0,2)=t.paramCode) as businum)"
         +" from "
         +" ExtendParamValue r,"
         +" ExtendParamValue t"
         +" where "
         +" r.dimension='CC_CHANNEL_CODE'"
         +" and t.dimension='CC_BUSI_TYPE' "
         +" and length(t.paramCode)=2"
         +" order by r.paramCode,t.paramCode";
  

一開始写成count(1) 一直出不认识1,一直没在意。整了半天以为别的地方写错了,最后把count(1)变成count(a.id)能够了

转载地址:http://mytkm.baihongyu.com/

你可能感兴趣的文章
免费 官方的ASP.NET MVC电子书-Professional ASP.NET MVC 1.0
查看>>
PL/SQL DEVELOPER
查看>>
HDU-1179-Ollivanders(二分图最大匹配)
查看>>
牛客假日团队赛1 G.Superbull
查看>>
CSS的继承性和层叠性
查看>>
MQTT详解以及在IoT中的应用
查看>>
[python] - 读取文件内容,并输出
查看>>
$.fn.exted({})与$.extend({})区别
查看>>
apache 配置虚拟目录
查看>>
前端开发——HTML学习笔记
查看>>
设计模式-工厂方法模式
查看>>
类的数据成员的 const、static等类型的声明和定义常识
查看>>
银行家算法
查看>>
发现一个全部用html5写的网站,里面还有很多知识
查看>>
在php中使用对称加密DES3,开发银行卡绑定,实名验证……
查看>>
Linux history
查看>>
活动安排
查看>>
Python中怎么进行单元测试
查看>>
Laravel之哈希/常用函数/分页
查看>>
spring 事务传播说明
查看>>