<select id="miningSolidWasteStockpilingStatisticsAnalysis" parameterType="java.lang.String">
SELECT
province,
solid_waste_category_detail,
IFNULL(SUM(number_of_stack_points), 0) AS sum_number_of_stack_points,
SUM(CAST(total_area_of_the_stockpile AS double)) AS sum_total_area_of_the_stockpile,
SUM(CASE
WHEN surrounding_agricultural_land ~ '^\d+(\.\d+)?$' THEN
CAST(surrounding_agricultural_land AS double)
ELSE
0
END) AS sum_surrounding_agricultural_land
FROM
mine_pollute_fill
<if test="province!=null and province!=''" >
where province = #{province}
</if>
GROUP BY
province,
solid_waste_category_detail;
</select>
sql对null数值或者字符串类型数值进行求和
最新推荐文章于 2024-07-10 21:37:49 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)