oracle与mysql不同,GROUP BY必须要跟select查询的所有列(除了聚合函数外) 例如:
SELECT TO_DATE(EVENTTIME) as dateTime ,OPNO as siteNum, count(*) as totalCapacity FROM tblusercapacity <where> <if test="date != null"> TO_DATE(EVENTTIME) = TO_DATE(#{date},'yyyy-mm-dd') </if> <if test="siteNum != null and siteNum != ''"> AND OPNO = #{siteNum} </if> <if test="userNum != null"> AND USERNO = #{userNum} </if> <if test="workshopNum != null"> AND FACTORYNO = #{workshopNum} </if> </where> GROUP BY opno,EVENTTIME