SELECT agent_id,city_name,agent_name, ROUND(CONVERT((SUM(cont)-sum(before_cont)),SIGNED)/CONVERT(sum(before_cont),SIGNED),2) as cont_increase from <choose> <when test="tableName == 'gt_report_receive_sort_week'">gt_report_receive_sort_week</when> <when test="tableName == 'gt_report_receive_sort_month'">gt_report_receive_sort_month</when> </choose> <where> <if test="startTime!=null and start!=''">and datetime >= ${startTime}</if> <if test="startTime!=null and start!=''">and datetime < ${endTime}</if> <if test="cityId!=null and cityId!=''">and city_id = #{cityId}</if> </where> GROUP BY agent_id ORDER BY cont_increase <choose> <when test="typeStype==1">desc</when> <otherwise>asc</otherwise> </choose> LIMIT 10
SQL 两数相除 保留两位小数
最新推荐文章于 2024-05-09 20:50:07 发布