SELECT
IFNULL(SUM(SUMS.AVGS),0) as OrderAverage
from (
SELECT
IFNULL(AVG(a.EnvirTemp),0)-X as AVGS FROM `metetable`as a where nDate
>=
#{start} AND nDate < #{end} and RecorderID=#{recorderID} GROUP
BY DATE_FORMAT(nDate,'%Y-%m-%d')
) SUMS
where AVGS>0
数据库查询一段时间内数据平均值再进行计算一段时间内的所有平均值大于零的和判断NUll
最新推荐文章于 2024-01-05 15:53:49 发布