mybatis 分组 group by

111112341 2014-08-05 03:11:17
<sql id="selectSql">
<if test="orderState != null">
"ORDER_STATE" = #{orderState}
</if>
<if test="gameName != null and gameName!=''">
AND "GAME_NAME" = #{gameName}
</if>
<if test="statementStartTime != null">
<![CDATA[
AND "END_TIME" >= #{statementStartTime}
]]>
</if>
<if test="statementEndTime != null">
<![CDATA[
AND "END_TIME" <= #{statementEndTime}
]]>
</if>
</sql>

<!-- 查询符合条件的实体对象 -->
<select id="selectByGameProp" parameterType="map" resultMap="BaseResultMap" resultType="com.wzitech.gamegold.funds.entity.gameTradingEO">
SELECT SUM("TOTAL_PRICE")"ORDER_TOTAL", COUNT("ORDER_ID") "TRADING_NUM", SUM("TOTAL_PRICE")*#{disCount} "COMMISSION","GAME_NAME","REGION","SERVER"
FROM "TBL_GAMEGOLD_ORDERS"
<where>
<include refid="selectSql"/>
</where>
GROUP BY "GAME_NAME","REGION", "SERVER"
<if test="ORDERBY != null and ORDERBY != ''">
ORDER BY "${ORDERBY}"
</if>
<if test="ORDER != null and ORDER != ''">
${ORDER}
</if>
<if test="limit != null">
LIMIT #{limit}
</if>
<if test="start != null">
OFFSET #{start}
</if>
</select>
为什么一直报错, 说ERROR: column "TBL_GAMEGOLD_ORDERS.END_TIME" must appear in the GROUP BY clause or be used in an aggregate function
位置:364
...全文
2236 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

952

社区成员

发帖
与我相关
我的任务
社区描述
PostgreSQL相关内容讨论
sql数据库数据库架构 技术论坛(原bbs)
社区管理员
  • PostgreSQL社区
  • yang_z_1
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧