zoukankan      html  css  js  c++  java
  • hql中不能写count(1)能够写count(a.id)

    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)能够了
  • 相关阅读:
    网站初学笔记1
    如何在新项目中使用曾经创建的用户控件
    C#用户控件的一些尝试
    MVC的含义
    Chrome浏览器面板基础了解
    VScode快捷键
    Windows中的键盘快捷方式
    node.js状态码
    JavaScript小结
    Truncate a string
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5183969.html
Copyright © 2011-2022 走看看